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 2884 invoked from network); 19 Jan 2023 16:29:40 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 19 Jan 2023 16:29:40 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1674145780; b=OpzkBO/TXzb9bDxIfHvllrJl2VZm7M8/15E+76IB6CRfbno02L94GRRWkybrVPlymOIlcX5Zo1 VYy7v+vpC7WiU1jsN3yF1idVLIyvtrmFIvXW1OCTmsF5zZgRN6/1Q6YZzYD/L1pVwcH3fOdoyB uCwivg+hcq9NMuMrRHETpMJAtLWAJrbSHy0cHciU0yv0/DOz60qbV9FrM/98FAMDYEbPbroEa6 Yir/1SjE7aSOqpcybKTNBEyE6uW/s7JM0tJiwG+7jOE2S9pvJ0V6NNlUkOUf7SRW/GYBuua23D T2oRMzhh5KrNuUnTCFfY1XnHkfvDx1BQCEd0WNyKiPTIMw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-lf1-f44.google.com) smtp.remote-ip=209.85.167.44; 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=1674145780; bh=zoRZga6stcdeq87di1Wvbczfc4WIDteWJW835HIW2fE=; 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:In-Reply-To: References:MIME-Version:DKIM-Signature:DKIM-Signature; b=Wr2L/5YhxTpZfpMK/+uvMxYHxIDaAj+w4JKwIK017NwGapYfFReJ6sNmbbsK1a6xAOl3TZBtz0 jQx7q5zrav9Xb9OGtdwV+x0aEz1L006Jujg3qR8n9kPInuiTPHSAedH8ZWoe7JLY+vhq3oBZDu Z1a4vnidaPN7V0Pnx1SNqYeQs3THHXiOZ64NJZYUpbw2VAyzYBNnusgLSGDPknx/gvmsUssfQ9 l/ttqalW7HuSrYLWn2ur9M4nVcqSN7SQHH7oB45bhSiiwa72Lz5nCYCK+93Q/wkLiAA0729/9e rYbcOIHqja64Sgl5muU9UhWmVRIL9ZT7e4AitdOlaOYBjw==; 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:In-Reply-To:References:MIME-Version:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=E1xy5/ptxPU1qPL/WeWKusttRhs+NdocKWIOJGJu1C8=; b=HjotdXIjDeEh2Yqnuqiw/0m4DG y0plJMcjsSvdJS43KC9KDgv+2pPO62G756cN9YhiVFdETYg7wxGCMnN8Y+5JiBMZ4BFceoIH1WMJU Fx5c82dZyaU7Mv/dkNqAMskI0Lywk/9biaT1qbHdrNqybPWb327bJep25QUV+fAWuk29XsO1ve46n Qf+OQsvHRPafD2hAi8JCkN/xW0YuT1yjquf5+3pn48JZVcDwfCuO1B/eykzgpCmdAnHrSljDn08VK CVtD3fGr2GNmJGkGkMOduyxR74azXulo+e0fNHiVkoOvzAM6IJGOXmm9MY0lOEVOUhb04b6d6C2zk H26Z/Rtg==; Received: by zero.zsh.org with local id 1pIXnI-0006Cu-EL; Thu, 19 Jan 2023 16:29:40 +0000 Authentication-Results: zsh.org; iprev=pass (mail-lf1-f44.google.com) smtp.remote-ip=209.85.167.44; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-lf1-f44.google.com ([209.85.167.44]:39632) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1pIXUQ-0002Yr-GN; Thu, 19 Jan 2023 16:10:10 +0000 Received: by mail-lf1-f44.google.com with SMTP id bf43so3923078lfb.6 for ; Thu, 19 Jan 2023 08:10:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=E1xy5/ptxPU1qPL/WeWKusttRhs+NdocKWIOJGJu1C8=; b=KdfSrXmrzX9/wpdPM+JQ1svUJMOrEF9THUyFRFNi6yXVaQaDE24jBPBKBs08vfguGl zdEct/kaUbBzeSvQkJptebrSu8BnhPIOw67veBa8NgJ6rR0xeBmB663oNjokhfvk+/O+ LGM2d3Syauk9HDig0N4St6qEW7dx9DPiiq1qu3EQvvp8Q3rjjxSPoTnwXi/Mg1Frfh9h zYxxHMFYqC8/XgE61hEPLphpnCTozDfSitCWxP+xFcviGdqaJUNl+cjI+T61uLFd8wES TcAtvpGqMtzBcBTFFeHcPdCkcc7N7VIGO3CX2Da2JB8mYOwbdLaR8ejFMTQjCm+CkUW1 K13w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=E1xy5/ptxPU1qPL/WeWKusttRhs+NdocKWIOJGJu1C8=; b=4mWCLwRRkOCqib6Y5oAPCtfXL3BKVpcct1SCdguuepY+omw1dK5TGLAJijfyPlrIBc LtdgpK2fGUgqYBZFObRX6ieDDmtl2cCTeB32a8pL8vpbEHo47iK1LrkhyigdRfIiBVR3 1UWyTf8/6cV4eqzeIqaNkRnCgNdoY2sulqpPkkKIHMlklvOR57nFK1CZiq3vouOJ7dfl ozl0pLm/UKskKDRqDsancjGRZOvcLQ4J4AQZbHIsTbzFedZ1RcrIPHp89Xh2l2IlLJIM E1q/P23rBYRCm4Qz+YviYQYbf3EOQTxSFB8MWg0RZQcQ/mUu8e+Vf/DdeH2uKzWdZxBH eYTQ== X-Gm-Message-State: AFqh2kpFdsijVaF5mjG0pcfCX/A69m8GBYxNrQbYvOCqOmWmH1xEoSyQ 5/5vj69a9lFUnxVslmjiMjg93gGtyYXnEYlBjCM= X-Google-Smtp-Source: AMrXdXs92BKqxbHdlNxuLUagedWDGAIjbAF0IvYk565SeHfbzuynhBGSbUApJc1/3L+owk5zx7+SnduJPxEl91xhGXQ= X-Received: by 2002:a05:6512:2215:b0:4b5:706c:ab80 with SMTP id h21-20020a056512221500b004b5706cab80mr612238lfu.226.1674144609787; Thu, 19 Jan 2023 08:10:09 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Sebastian Gniazdowski Date: Thu, 19 Jan 2023 16:09:42 +0000 Message-ID: Subject: Re: check if coproc has output To: Pier Paolo Grassi Cc: Zsh-Users List Content-Type: multipart/alternative; boundary="000000000000c4e33205f2a02a3d" X-Seq: 28669 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: --000000000000c4e33205f2a02a3d Content-Type: text/plain; charset="UTF-8" Are you running zsh 3.0? That would only explain lack of following in zshall: jobtexts This associative array maps job numbers to the texts of the command lines that were used to start the jobs. Handling of the keys of the associative array is as described for jobdirs above. On Thu, 19 Jan 2023 at 16:08, Pier Paolo Grassi wrote: > I'm sorry, what is $jobtexts? it seems an empty variable to me and doesn't > appear in zshall manual > > Pier Paolo Grassi > > > Il giorno gio 19 gen 2023 alle ore 17:02 Sebastian Gniazdowski < > sgniazdowski@gmail.com> ha scritto: > >> You could get pid from $jobtexts? >> >> On Thu, 19 Jan 2023 at 15:43, Pier Paolo Grassi >> wrote: >> >>> I realize now the subject doesn't reflect the final version of the mail, >>> sorry for that >>> >>> Pier Paolo Grassi >>> >>> >>> Il giorno gio 19 gen 2023 alle ore 16:32 Pier Paolo Grassi < >>> pierpaolog@gmail.com> ha scritto: >>> >>>> Hello, I want to populate an array from a long running process, >>>> something like: >>>> >>>> long_running_process | while read line >>>> do >>>> array+=$line >>>> done >>>> >>>> problem is, since long_running_process does not continually produce >>>> output but only some times, when i try to interrupt this pipeline with >>>> ctrl-c I have to wait until it produces some output for the process to >>>> terminate (because, as I understand it, when it tries to write to the pipe >>>> it receives a sigpipe due to it being already closed) >>>> >>>> I have tried various constructs with trap and even coproc to be able to >>>> intercept the ctrl-c and send a sigpipe to the long running process, but to >>>> no result. >>>> >>>> I wonder if someone has some solution to share for this problem, thanks >>>> >>>> Pier Paolo Grassi >>>> >>> >> >> -- >> Best regards, >> Sebastian Gniazdowski >> >> -- Best regards, Sebastian Gniazdowski --000000000000c4e33205f2a02a3d Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Are you running zsh 3.0? That would only explain lack of fol= lowing in zshall:

=C2=A0 =C2=A0 =C2=A0 =C2=A0jobtexts
=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 This associative array maps job n= umbers to the texts of the command
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 lines that were used to start the jobs.

=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Handling =C2=A0of =C2=A0the keys of the = associative array is as described for
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 jobdirs above.


On Thu, 19 Jan 2023 at 16:= 08, Pier Paolo Grassi <pierpaolo= g@gmail.com> wrote:
I'm sorry, what is $jobtexts? it seems an e= mpty variable to me and doesn't appear in zshall manual

Pier Paolo Grassi


Il giorno gio 19 gen 2023 alle ore 17:02 Sebastian Gniazd= owski <sgnia= zdowski@gmail.com> ha scritto:
You could get pid from $= jobtexts?

On Thu, 19 Jan 2023 at 15:43, Pier Paolo Grassi <pierpaolog@gmail.com= > wrote:
I realize now the subject doesn't reflect the final versio= n of the mail, sorry for that

<= div dir=3D"ltr">
Pier Pao= lo Grassi


Il giorno gio 19= gen 2023 alle ore 16:32 Pier Paolo Grassi <pierpaolog@gmail.com> ha scritto:
<= /div>
Hel= lo, I want to populate an array from a long running process, something like= :

long_running_process | while read line
do
=C2=A0 array+=3D$line
done

pr= oblem is, since long_running_process does not continually produce output bu= t only some times, when i try to interrupt=C2=A0this pipeline with ctrl-c I= have to wait until it produces some output for the process to terminate (b= ecause, as I understand it, when it tries to write to the pipe it receives= =C2=A0a sigpipe due to it being already closed)

I = have tried various constructs with trap=C2=A0and even coproc to be able to = intercept the=C2=A0ctrl-c and send a sigpipe to the long running process, b= ut to no result.

I wonder if someone has some solu= tion to share for this problem, thanks

Pier Paolo Grassi


--
Best regards,
Sebastian Gniazdowski


--
Best regards,
Se= bastian Gniazdowski

--000000000000c4e33205f2a02a3d--