From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,HTML_MESSAGE,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 3030 invoked from network); 26 Mar 2023 15:29:29 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 26 Mar 2023 15:29:29 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1679844569; b=FjDwkm4+U5WFMlRJA9CvvwGAjQvdjxZcDj4E61rQPA0anNR2/vtg+Zx3iwUPgNPKkJbzbD69CW mktvAJe2VIWmN1/vE2sGjCbQPeIloLXSeHqMoXUNzoibQ6jxBCB0WxjzwFKrhYzZkH3yBb1wPi kJ2ZBRZW934Fox7SCf7PUKhk+1lQWVLcYbNNtbORdIBRWBejB9i8XVB1+Y7coe5PlD2T3DkGZJ ClxFFBjd1Th6uaZCuJl9T2obqUwwvaRkcAXLTk73i3mCmkWaUGahSZC5xFdN5BR7TCRYe5JYFd I2WLBswmFOl4KVw9fw3fIq+7glMLunlNTkPnnxYGNRRSQw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-pl1-f178.google.com) smtp.remote-ip=209.85.214.178; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1679844569; bh=M/HMYx0SsmyVeQJwx/+nhJR2Mds/MEL+HwZTQXsworE=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID:Date:From:Reply-To: In-Reply-To:References:MIME-Version:DKIM-Signature:DKIM-Signature; b=b9X8469bPFamLDffxvZ8EX0w/CgqSerC8AhWiajFuy+FXn6oOqXOMM+US+jpc7Pdr0EAwW46fT biPBxUlYL7CgcRhcZ8I9n5WNUkt3qHnxNC2LEvdkmxtQH2nOhd4Pya/mDcuzq+LBlVUQfqG1nS 4MYmyz3wJl83eQaMudP0VJ9kGUXaaUnWLbXlbPWUVJyYvkv+QEBztLkQtsz83wPUZOmqq25LGX k8BSByX77h/pYb5mZT5VyUJArxCNm/2B7VWlhc1ORd6UH52O2/Zrz3PlZC0h6rcbwGuFTDMzOd C/9AkH9f5MpBSuGbRTTm2gwmGlXhftwmlrmpsDISDyUZoQ==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID :Date:From:Reply-To:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=fa2wCkfHm3U0BLvAzP/0nOCz42Fy7S60s4fKEflTw5I=; b=Ad+qfuOyXI3gFdq7qqH8B0ulVw 0YdqWynjK3l0bOC84o1tyLuOrACR26gHThMGv/I7bpbGU8XzvKp3GawiecfsKTxNSa8fWuhOs7Xph I3ICSLk/QErglgNWAFSLwMD44Cqw1mA1PROBvZrVhLt1o/W/0XdOaf9ZNAciN+9DjjPdEjgpB20DU 0LJwvg12gyz8XhWUyImKtMpoQioV+f0yNqRY4MejjCuXXlx6lEyjtcSOFRNr2XmvFbnCDrNWsl0P1 3HYVP5hAfCnCJPyllUzNkqWi4cfi4aRmjzCzS1qLI0BoZsk74J0e/j8+7WSj2cldo8kebCxjPJ7SY xUdI6AfA==; Received: by zero.zsh.org with local id 1pgSJF-0005Yg-Fe; Sun, 26 Mar 2023 15:29:29 +0000 Authentication-Results: zsh.org; iprev=pass (mail-pl1-f178.google.com) smtp.remote-ip=209.85.214.178; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-pl1-f178.google.com ([209.85.214.178]:40628) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1pgSIR-0004qd-Q7; Sun, 26 Mar 2023 15:28:40 +0000 Received: by mail-pl1-f178.google.com with SMTP id u10so6163713plz.7 for ; Sun, 26 Mar 2023 08:28:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679844518; h=cc:to:subject:message-id:date:from:reply-to:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=fa2wCkfHm3U0BLvAzP/0nOCz42Fy7S60s4fKEflTw5I=; b=gCVZ8HLbhBvOwGr/wR5/wGxa2EIUe/SJPTGnvW4WT+FgLuyyOo35Nm3l4s1Oprs24+ QDrpNT2UTANdBWfnjk3s20C7fx7EjJ3pl9CpkoTc9BHqzwzm37wIodOn1cXYfzxgyVNE PiSjGTUOfUrFOvMCz56YvQZJTtIPblXz4EUz0Y4TGtV6m5BtLuERhShVv49RP6V52Zqz p6TXW3fYDUVDwRxeKrFdjeI1vV10Q1c9+E8h4l2/UKllAoPo+CWLwyQsgKduTFE9X1qo OVDA+uSNZhK2/RLcyWY2zQpFeMDsA+hEdDSKIlW5sesvyZ0qDq170JY7ru2/Vax381xw FnJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679844518; h=cc:to:subject:message-id:date:from:reply-to:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=fa2wCkfHm3U0BLvAzP/0nOCz42Fy7S60s4fKEflTw5I=; b=6e3bAFQD7k5sr8HYeyA6ZbFvO30y2sIhAwJSbktwy0rOcswDvuI+mkpTrxvHtEHcIW ztXPNqKFjmwsoY0XVAqNE58eWpc0ESVDHfau78cZsq1frJsF72Tm+fefyfRdywcsDfZe OpjwhjmapexVqLQ9SBOBAxqDmnyMYK/FjK4aaHOBaefOkTXFoAWKRvDKbWmZvNeozFQ8 dZwaxzW5iCeMFvtOpI46S0Ef0fnFz9/wv6lBvO8gbxC9AOUzAIQMN9e3SO+MChBFK+zs BJipdzceddhT+bQbP2ewUJyAtdiEI7p1toQHrUASN/ZJeDlHsKFsZt7CVRCq2gw7AcQX TxEA== X-Gm-Message-State: AAQBX9emzC3GGKwSNtmX5QYznjnAohNFCDV7uZOIO8OONWBb+TGd2ZaY 7ki+dZwC5DRlJ0/E2pPtM04/jTgi/8qz6/jQPT1HQ5KMoQ0= X-Google-Smtp-Source: AKy350bn57U8smPJAwBBpXb1Gxcn61p3QwE2SbbPfLE/gRYBPC6mn+mpnvGeXw8XjBGaske5ZuNwmkAGgynwBYIjdjg= X-Received: by 2002:a17:902:868f:b0:1a0:51f6:a252 with SMTP id g15-20020a170902868f00b001a051f6a252mr2963951plo.3.1679844518436; Sun, 26 Mar 2023 08:28:38 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Reply-To: linuxtechguy@gmail.com From: Jim Date: Sun, 26 Mar 2023 10:28:26 -0500 Message-ID: Subject: Re: strange interaction between read command and pipe to less from function To: Roman Perepelitsa Cc: zsh Content-Type: multipart/alternative; boundary="000000000000cca58c05f7cf478b" X-Seq: 28983 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: --000000000000cca58c05f7cf478b Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sun, Mar 26, 2023 at 9:56=E2=80=AFAM Roman Perepelitsa < roman.perepelitsa@gmail.com> wrote: > On Sun, Mar 26, 2023 at 4:34=E2=80=AFPM Jim wr= ote: > > > > [...] 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+=3D("$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 --000000000000cca58c05f7cf478b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Sun, Mar 26, 2023 at 9:56=E2=80=AF= AM Roman Perepelitsa <rom= an.perepelitsa@gmail.com> wrote:
On Sun, Mar 26, 2023 at 4:34=E2=80=AFPM Jim <linux.tech.guy@g= mail.com> wrote:
>
> [...] a function I am testing [...] has the following read statement w= hich is part of a loop:
>
> for N ({0..255}) {
>=C2=A0 =C2=A0read -s -t1 -d $'\a' $'c?\e]4;'${N}$';= ?\a' && XC+=3D("$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 c= ompleted, shouldn't less be in control?
I just added 'sle= ep 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?=C2=A0 Using command as= follows:

cvt_256_colors_2_rgb_hex_fmt | less

Thanks for the quick response.

Jim
--000000000000cca58c05f7cf478b--