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 5628 invoked from network); 19 Jan 2023 16:52:32 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 19 Jan 2023 16:52:32 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1674147152; b=lc7bX1SDtt7CdiEq7Dc7fdwVbb74vj2z8S70UlGM3V0vFGK/zXmK2dien/m7os1PRzG/Uuk2+A lpuNkIR6T3pXXj7fTu2X5X34HKU2G5fmp75Od1s7u331gYC+1J4z4wbLfH3bww99tX8yNRUwjv BMI/HLj5NCYiE9Q//UQbgQfBOLdHUz5NiKdegfGwgKkIM76k7bYIhkPma3ZFu5P+8bZS7BLCvR T0lQsy7p3E8qm0Arkzz2KJ0Rn9ik9kO7S9l9XoD9IfnlU762o7OaB8pX5z6oFfXYZAR0/bjXK2 hsVFdF60UgJqRmidTo1E7LwyI9ngSjAjk4IeVjxogJZpRA==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-lj1-f177.google.com) smtp.remote-ip=209.85.208.177; 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=1674147152; bh=3cw049+tOSsEEmO82/JrSeR4d41p9lLY2ZqkooLPk08=; 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=GMm8NttPuts5HCtNsGcS4JRJhcybzMQwgFGO7Sy9S+7jdgfBb1R1Q1VaGuBKkgS0PynK+Pd0NJ NhE5ait/P4lHYznfkpjVmAxotxs0tSHrZn5ZTYvtp92roNPNdzNoQa+xcfiHnbOaQ1/TJhfiIq J7+FDLcHIfB1E7AfnjP7ios9V8Fd3cOP9yGAYw7qWCZzzp1pLmCIhRzRtncbTQ0DwJVQDovwCe n/uUVicqdUB39n2qt476Lcd2q1Cgv+ArQoWXESIJz8TiGeZIUI4WqQXhR+vltBZfkWdLevwXoU Mrn/i2YzGTmVeKpu6cS3CcuIMi5Ipf6TIETEpVDU9yUxsw==; 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=O7FxKKposf+IjTDS7pWATGPb8J44UsVBmqCWeuEsiOQ=; b=awRILOxenJR41U8ciFUH40W7Ig XDLG2pG5EuJj3xTp52nrmt6qputbqSIgx1UCohuXdJ8OAvrm+tK5P51TpQzNf1DU7xwVWFP09YWXz QHW7XpsNSN2rbz+B56XC+XncpmaQe3luWeP0RBYOnJi+wxmLDwV/264i+N4DsYWQ85JzbRGrLfIb1 FtIxo9bSC6xipbXgtcUME+Y2LW9ogbvAxNukLdBOuP7x7whSTR4GduhAB55z5n2bqTJB85bSY8dJN 9zGn2GBmimqdjliO84YPt3tx4U3cmsGHXjmsiONr0mvOQLdh0Dm2DLMP1ZxP7xdcZXaEIgu5goqKM l9XtNycg==; Received: by zero.zsh.org with local id 1pIY9Q-000Buc-6y; Thu, 19 Jan 2023 16:52:32 +0000 Authentication-Results: zsh.org; iprev=pass (mail-lj1-f177.google.com) smtp.remote-ip=209.85.208.177; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-lj1-f177.google.com ([209.85.208.177]:44976) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1pIXuK-0007wk-JF; Thu, 19 Jan 2023 16:36:56 +0000 Received: by mail-lj1-f177.google.com with SMTP id y18so2660094ljk.11 for ; Thu, 19 Jan 2023 08:36:56 -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=O7FxKKposf+IjTDS7pWATGPb8J44UsVBmqCWeuEsiOQ=; b=Uyv9pV0uefvXw2UIKnK8chwBC0mGdOANV93FJJtEWBQxxWMtqG6kjMm5nzvXr80Se1 zxFDyvbn/2R4GzctELYp0du27clPisykQR+nBlAqgTMUWMJc6WTcidvaG84KxskEonH7 IpO4fJsp3YwMo/O9eXXXbSFSpupZbanm5AKM+j5nzjsJ1HPlAfws3Dmgv47deX/aiBLl uqjYRJlJ+adMJaZf0AaHFbCU8Z/GNdUUL0YVkC+O91rKHqTLZ9ObPEyClRxkhgUV/fKh W0TQ2efn57Ihk3xRxERbH7u8IlGwBYfxuK9ZuR6sZNha1ZiA7cjJz7pXeeJEKUCPOksP 5k9g== 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=O7FxKKposf+IjTDS7pWATGPb8J44UsVBmqCWeuEsiOQ=; b=vP5r6mUUDVCV1AJ9Ih2sKeM5bTARx00Lf8fxISLkMOUmVGn73GmAqmmEEyFhzmZ10f teRlTn7NgWsZydJpCBQHkJA515T6wh4/HM4eO0GTb3+4VSCZomFbxEcDqlot9bWSg4Kh qdxk80hiEhj/NM+FIBCfG4SZae6qBNLAHAs/VSzmEPIDAYAkgR/X08SPxabmrwE0jH42 Jom8MEfHUda/QSBK1EDHqDt7PhBeOhc7g3f0fctC5f9ZVyWG9XjbUa0B4i6QafCj0fE0 uo87Nm4NdnMc3ZZJIuklOIYfJ7JxLqEhZfnAZx4PGjjZc1A6d2bb/xPnogIDAKExOG/7 geEQ== X-Gm-Message-State: AFqh2kpi0lUFfyU+x/xPhXXElxNBDWkoK/RVT2PRQXwFC5mB8BNzL6ik vqn6gbkNuPsS2lprPCn5xALMM0yzRrdjjaw48dI= X-Google-Smtp-Source: AMrXdXsptJDaF4q5M3Gn9+ICl2DMFCcP7YLu+qYw+vJGZU0ukvyuvUC77VorE8gBTvsRS76pO2700kxvcR/vAxHOJhI= X-Received: by 2002:a2e:9bc7:0:b0:288:bde2:45e0 with SMTP id w7-20020a2e9bc7000000b00288bde245e0mr568394ljj.10.1674146216172; Thu, 19 Jan 2023 08:36:56 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Sebastian Gniazdowski Date: Thu, 19 Jan 2023 16:36:29 +0000 Message-ID: Subject: Re: check if coproc has output To: Pier Paolo Grassi Cc: Zsh-Users List Content-Type: multipart/alternative; boundary="00000000000084611105f2a08a4c" X-Seq: 28673 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: --00000000000084611105f2a08a4c Content-Type: text/plain; charset="UTF-8" I've read your post briefly and saw that you need to terminate the background process. I recall that I was doing it in configure-wrapper that I once wrote and that I used jobtexts. I do recall that it does contain entry for coproc, so you could examine it in a INT trap and send a signal to the coproc writing process. On Thu, 19 Jan 2023 at 16:14, Pier Paolo Grassi wrote: > I did again the search in the manual and now I found it, maybe I mistyped > the first time > where do you suggest I try to print this array? > > Pier Paolo Grassi > > > Il giorno gio 19 gen 2023 alle ore 17:10 Sebastian Gniazdowski < > sgniazdowski@gmail.com> ha scritto: > >> 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 >> >> -- Best regards, Sebastian Gniazdowski --00000000000084611105f2a08a4c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I've read your post briefly and saw that you need to ter= minate the background process. I recall that I was doing it in configure-wr= apper that I once wrote and that I used jobtexts. I do recall that it does = contain entry for coproc, so you could examine it in a INT trap and send a = signal to the coproc writing process.

On Thu, 19 Jan 2023 at 16:14, Pi= er Paolo Grassi <pierpaolog@gmai= l.com> wrote:
I did again the search in the manual and now I found = it, maybe I mistyped the first time
where do you suggest I try to print= this array?

Pier Paolo Grassi


Il giorno gio 19 gen 2023 a= lle ore 17:10 Sebastian Gniazdowski <sgniazdowski@gmail.com> ha scritto:
Are you running zsh 3.0? That would only explain lack of following in z= shall:

=C2=A0 =C2=A0 =C2=A0 =C2=A0jobtex= ts
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 This associative arr= ay maps job numbers 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 k= eys 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 <pierpaolog@gmail.com> wrote:
I'= m sorry, what is $jobtexts? it seems an empty variable to me and doesn'= t appear in zshall manual

Pier Paolo G= rassi


Il giorno gio 19 gen= 2023 alle ore 17:02 Sebastian Gniazdowski <sgniazdowski@gmail.com> ha scritto:<= br>
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 version of the mail, sorry for that

Pier Paolo Grassi
<= /div>


Il giorno gio 19 gen 2023 alle ore 16:32 Pier Paolo Gr= assi <pierpaol= og@gmail.com> ha scritto:
Hello, I want to populate an array from a= long running process, something like:

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

problem is, since long_running_process d= oes not continually produce output but only some times, when i try to inter= rupt=C2=A0this pipeline with ctrl-c I have to wait until it produces some o= utput for the process to terminate (because, as I understand it, when it tr= ies 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 si= gpipe to the long running process, but to no result.

I wonder if someone has some solution to share for this problem, thanks<= /div>

Pier Paolo Grassi


--
Best regards,
Sebastian Gniazdowski


--
Best regards,
Sebastian Gniazdowski


--
Best regards,
Se= bastian Gniazdowski

--00000000000084611105f2a08a4c--