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 7929 invoked from network); 19 Jan 2023 17:08:54 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 19 Jan 2023 17:08:54 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1674148134; b=bBoxYjmBFSwabt6dJmuemVjuGXqBn8jfSXPgckpQshBxF13kf4lh2bPvpShMaaCTyHvjNKI7EH nh/2GibfO2EWp2rq37edzutsGh/XV3/2Xw350/esM7YfDFzU2YWpo7eT1dX9eKKRuAivYQYFkV TzXzHT9aLFGI422jo44ER7avmdZB2gBicajBjpjwTAx2B52Y7C0bEEkBcze+HbBolsldOU4qOC LBcu6x7Fh5+TbI8/ISKqzHcv19o+4XCnbQC8xlDltQcmYeJ5LK5H6uT+6+bfNGmZQJYyktghLM owu684b6DgObxb2OPltTY/zP12MhbQB5VjUGkHVqdlKlFw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-ej1-f47.google.com) smtp.remote-ip=209.85.218.47; 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=1674148134; bh=h0ZbN+9igmL/SrEevbFK9TlLGZgw1g4LVdvDi8Rejm8=; 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=roxzHsJ6sanSj9znUQjXVvO0ug/UFCENPGW85JghpdkyftUjTF+caUA6JKVyQi6zhg70WF/+zc Y3H2HxcwhvRNNbxaDeD64pzaDeBgFYEvZwXdU3T64t2yR2oz6EQQgAYGN45OiVsY5IfRVMx+iK o02ESwUx6PdwgCBrdbuWBsQl4JL+nHIaqD4LdqDFkulsV0MDx2nZLVHYEdFYHzVbxYneGe39R4 Obphdi2Wk0V4TwCFA/VnoGeMKbpEPrhGCl+FDHfWRBGRxjWGsFrLPdWV5ZNTcw51aS5BLB4LqF ner+pDAlcCKl9dpsj//JWT5tc8DHdK7LMiglQzkJZvULNw==; 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=sCFbwp+NnKToMAHc/503DOjW2qcVjdcqbEfvKU9D/Hg=; b=GhMXWPnDw1nw/A9SXcQOQ4TjjB rPBdGtiYkj70BfDaErUovRgg9XuNcYMWv91qk7FBMVmPgDqdI3zFzax9aL8dJ4gqR6GGiCyqDu9qN 6hiojdt18kUAXeYTklmJT/dK2GmwDb7oxbpkK4TcxqyU+Eupss6VQVybhV3S4WqcH+/2awvO0IOUp FlaK45Emqj3CTFqqFKczSDFX9GVbxbwcrmUzX/yT6k2cdQzZmblfAH2FDI7jK4tzrsEubyMBX/cLg 7k612fElRtl2A1gnp01daZBC1qFFcaIYuitzCGZ1LDYMVK+3j+DeiZ8Bp8ysI1OFB93mSU0mzXKFn 7KaQmErQ==; Received: by zero.zsh.org with local id 1pIYPF-000EZa-Dw; Thu, 19 Jan 2023 17:08:53 +0000 Authentication-Results: zsh.org; iprev=pass (mail-ej1-f47.google.com) smtp.remote-ip=209.85.218.47; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-ej1-f47.google.com ([209.85.218.47]:46780) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1pIYB0-000C52-NC; Thu, 19 Jan 2023 16:54:11 +0000 Received: by mail-ej1-f47.google.com with SMTP id qx13so7210491ejb.13 for ; Thu, 19 Jan 2023 08:54: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=sCFbwp+NnKToMAHc/503DOjW2qcVjdcqbEfvKU9D/Hg=; b=VQp30RhIwrUVv2FpqKUaQDDkSJgyrzzHHjg5k07WJqhScaDEOIs5xr9JjZZkf2kLOt CI04ZhDwOwYKaAGaJIQ1XtQ0ByzfWxHlyrVDrfsd7Qb/tFKg6RJoW100yAErGLNG5J1T WHcM1q2wWCixugsmaTsQ7u9b14rqrtHLn5bwW0zEO+I2MgJMh8OR8NpH7R+28nX/d8Pu wyHBZg24alc6dTMfjFRGSsB4k6HDjCShQKJPyw+ynus+AZ05QOFeL1LS3BsBcI5xxt5S MVT2nTEqcwBayI8ckWz1qIt1l4AgerjjIf+K/rHHGmwSbJlUKAYOe6MfVgU9Kkm+1bpA 4fLQ== 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=sCFbwp+NnKToMAHc/503DOjW2qcVjdcqbEfvKU9D/Hg=; b=S+xzmG2hHMLTYVj6qDIlRXKxrsXrBpVq7PuwASIF1rJ28ySVsnVV7s1Ngdtq2osQKB JeON85UI/wX+Hl1f/fl8r+9MWJ9kiXQNfTzXq/HGp4I7fvo7EH+9S0dCFen9aGspgJHL SMZSEN3YlbIcW+8iv3njfvecjQxXFjuK9mZNxvHLMUUeBE/F2MOfDUR4Fe4pYstXHLSC wlb3ozJJhXtohM909cMQG6l4c9mxMIkFdHNsOUngwcLXlV0vMqA4xgMLHLM+fM2QO+bG cNClpj1OwSPVUOkYhY9g5jHvTRrk4hsL8sHHD4Y9OANn2RD/5wlmHnep6VGVJKZkST5d FgmQ== X-Gm-Message-State: AFqh2kqT3ybTa2kF6SXm1Vp8RkZj88EOZrB+lei75SLtkI1HeYLwHSxD vwusNT0vHhkhNMz0mlFGd0Oczuy8kOcpLu3+nVyzP6AwnoA= X-Google-Smtp-Source: AMrXdXscw0/DysO49j1JDZHy2qCq6ehl7y7RGP7Gb/hgM00/Wd77bXHJqxyULCtSk9p7eUBHeoYSMyzz57SZvHdUmqs= X-Received: by 2002:a17:907:8c16:b0:871:4172:8c3d with SMTP id ta22-20020a1709078c1600b0087141728c3dmr747853ejc.33.1674147250331; Thu, 19 Jan 2023 08:54:10 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Pier Paolo Grassi Date: Thu, 19 Jan 2023 17:53:33 +0100 Message-ID: Subject: Re: check if coproc has output To: Sebastian Gniazdowski Cc: Zsh-Users List Content-Type: multipart/alternative; boundary="00000000000028669005f2a0c888" X-Seq: 28675 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: --00000000000028669005f2a0c888 Content-Type: text/plain; charset="UTF-8" The pid for the coproc is easily obtained with $!, but when I tried to use it in a trap I couldn't kill the process, maybe because of the bug Roman is pointing out to. I will now try to recreate the problem with a simpler example like Roman asked so it can be better understand thanks Pier Paolo Grassi Il giorno gio 19 gen 2023 alle ore 17:36 Sebastian Gniazdowski < sgniazdowski@gmail.com> ha scritto: > 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 > > --00000000000028669005f2a0c888 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
The pid for the coproc is easily obtained with $!, but whe= n I tried to use it in a trap I couldn't kill the process, maybe becaus= e of the bug Roman is pointing out to. I will now=C2=A0try to recreate the = problem with a simpler example like Roman asked so it can be better underst= and
thanks

Pier Paolo Grassi


Il giorno gio 19 gen 2023 alle = ore 17:36 Sebastian Gniazdowski <sgniazdowski@gmail.com> ha scritto:
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 proc= ess.

On Thu, 19 Jan 2023 at 16:14, Pier Paolo Grassi <pierpaolog@gmail.com> w= rote:
I did again the search in the manual and now I found it, maybe I m= istyped the first time
where do you suggest I try to print this array?<= /div>

Pier Paolo Grassi


Il giorno gio 19 gen 2023 alle ore 17:10= Sebastian Gniazdowski <sgniazdowski@gmail.com> ha scritto:
Are you r= unning zsh 3.0? That would only explain lack of following in zshall:
<= div class=3D"gmail_default" style=3D"font-family:"times new roman"= ;,serif">
=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 <pierpaolog@gmail.com> wrote:
I'm sorry, wh= at is $jobtexts? it seems an empty variable to me and doesn't appear in= zshall manual

Pier Paolo Grassi




--
Best regards,
Sebastian Gniazdowski


--
Best regards,
Sebastian Gniazdowski


--
Best regards,
Sebastian Gniazdowski
--00000000000028669005f2a0c888--