From: Jim <linux.tech.guy@gmail.com>
To: Roman Perepelitsa <roman.perepelitsa@gmail.com>
Cc: zsh <zsh-users@zsh.org>
Subject: Re: strange interaction between read command and pipe to less from function
Date: Sun, 26 Mar 2023 10:28:26 -0500 [thread overview]
Message-ID: <CA+rB6GKWVJ2C1pxzykWHMT-GzmcSo0GzBmS0TSAe2PpnOvGxww@mail.gmail.com> (raw)
In-Reply-To: <CAN=4vMpUG2xqpsOFg-o_9LaO_j5eMTFgErjaUfvTQSonqETetQ@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 970 bytes --]
On Sun, Mar 26, 2023 at 9:56 AM Roman Perepelitsa <
roman.perepelitsa@gmail.com> wrote:
> On Sun, Mar 26, 2023 at 4:34 PM Jim <linux.tech.guy@gmail.com> wrote:
> >
> > [...] a function I am testing [...] has the following read statement
> which is part of a loop:
> >
> > for N ({0..255}) {
> > read -s -t1 -d $'\a' $'c?\e]4;'${N}$';?\a' && XC+=("$N ${c##*;}")
> > }
> >
> > The issue is when the output of my function is piped to less.
>
> Both the function and less read from the TTY. Which of them will
> succeed when you press a key is anyone's guess.
>
> Roman.
>
OK, but if the read is already completed, shouldn't less be in control?
I just added 'sleep 2' before the print statement and still see the same
result.
Even if the last read didn't receive any input it should have timed
out(-t1).
What am I not understanding? Using command as follows:
cvt_256_colors_2_rgb_hex_fmt | less
Thanks for the quick response.
Jim
[-- Attachment #2: Type: text/html, Size: 1584 bytes --]
next prev parent reply other threads:[~2023-03-26 15:29 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-26 14:33 Jim
2023-03-26 14:55 ` Roman Perepelitsa
2023-03-26 15:28 ` Jim [this message]
2023-03-26 15:49 ` Roman Perepelitsa
2023-03-26 17:04 ` Jim
2023-03-26 17:23 ` Roman Perepelitsa
2023-03-26 23:50 ` Lawrence Velázquez
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CA+rB6GKWVJ2C1pxzykWHMT-GzmcSo0GzBmS0TSAe2PpnOvGxww@mail.gmail.com \
--to=linux.tech.guy@gmail.com \
--cc=linuxtechguy@gmail.com \
--cc=roman.perepelitsa@gmail.com \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).