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 29949 invoked from network); 19 Jan 2023 15:44:17 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 19 Jan 2023 15:44:17 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1674143057; b=QH1VH6+DVJCp4vAPCycCW4PYKyGtI/PLDt6LqDdd4jybopgf29vIUDlp6Jeh5tqNLhMj961x5g bOR7abrGtxDFNkomsb0wUqjZXxPCeni7ngGqsn0nNBrhrQ0xQCoaMO4YXbSMdLDApnU7vbvw1L 1V9I0sWLMv4JG4ZL9gcjffjb8Zg/oeyP0NzK+0LsSdyTBDu9P546o+HBG8zXeIPFGfdXGwdUgW IlFn4ow3dsIpuiCJOgEzt5r9spoEaRKFwoGr+edPuk5q0jTZJnnrZ95DtRiyRHMzyKf2fbxd59 lXvpWlkX8NWr+gzaybk2kwzqnVepADQxxRTynekFU6fsMw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-ej1-f53.google.com) smtp.remote-ip=209.85.218.53; 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=1674143057; bh=jfY+snK3jdAA2u14WCAlSjN3dBuJUyefxiDkFBp2b3I=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:DKIM-Signature:DKIM-Signature; b=UKE3gEF1kJnIdgAZ0FAgVcYuRtBGyvfxGvl38U5KJek3N1kjl4ReFYN+ynLVDk2QfHSYuWf+zt SZ4fjLSg3PKxjQ6lXz0G+C4nKwvebjqq17JNDCG65wIXwL9MGwbNiyNEOBiCBimPf5tlbthLKZ 1X73k+B3MCTsOYU6sFqKt1KWjt4Vb+coAeQ6DFWXcaHF7z2AMUKfjhFGIKKpYnUv20j4uhvWfb WuRiFRPPLFL85MVQqiRcEqXuAOxJPguSJYJdu0QiFbKBAIBVtWqhCcptrIptm241tvYkYRpqct YAIPZDtqpFjRZrVswpc8RxQUf+gVXI6IXLlubcwKqREhxA==; 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:To:Subject:Message-ID: Date:From:In-Reply-To:References:MIME-Version:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=iZteZ5L/UKTxHpWJlooFZf6pTigDb1ncBXd9YGOYETk=; b=l3dx5V86Rpec5UCB++RfrGqRn9 WD+8ZCwANnm9S3KyZPKGTvrlnL9vgN8L/tXWdCKLjcovsVPxlIjqkFbvxMrbyks5Htw1h6d7z6Cth IzmYbL2YCnQcmaAMoj4P/ehhNZCoSTe/QO5Tm5y7QwNZ/L9+49ESqqPNvET57gAqRR8p2Drqqcuf/ nCPbCAy5Pq1uk713C40kdGeSVbxjkYRdWN2JIjPoYsbWlryWaALtd3Ibwj+opyHyfT1rjvhWFarBV 4EUHR4y482TBQFv8Z1iN2tRb75tQEmBhCfeHJmUeyDzHwaBdBWQ6muFAvbMCurvSiWPZTRGQkMQjM Mg2nUmNQ==; Received: by zero.zsh.org with local id 1pIX5M-0000W3-WD; Thu, 19 Jan 2023 15:44:17 +0000 Authentication-Results: zsh.org; iprev=pass (mail-ej1-f53.google.com) smtp.remote-ip=209.85.218.53; 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-f53.google.com ([209.85.218.53]:38432) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1pIX4Q-000PnU-9Z; Thu, 19 Jan 2023 15:43:18 +0000 Received: by mail-ej1-f53.google.com with SMTP id mg12so6740911ejc.5 for ; Thu, 19 Jan 2023 07:43:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=iZteZ5L/UKTxHpWJlooFZf6pTigDb1ncBXd9YGOYETk=; b=ar1MqXP5vY/1g6DLNCEehyn7CuuYJctc2GVokR6l2xAjdPgSIASLVXlphvRpR7afFg b7cxqerbG3/2AeLvODlmWRRz8UZ/U8Gn3iP5YmT4DKQL8tKLhcTGFBKxagvUccqJCqtY KyHiBJoV3hZGBV5GdDfvVYhX/4iOlm1pz/D3jvN0jiF9Pck+rHh9Yssq/UcCRd4PtWiV Inhr2qerjuUHTt0HHzHyGF3VUAUqCZ57io+FfkkhK6cEzkMOtwyOfJUAWBI130q+kCYH tmJLIH3wBF7dlM73f3O7mazRSHvZyApQC3hwSVk2aggLev2F0Ki7NBES/SfVbrWFTru5 yiLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=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=iZteZ5L/UKTxHpWJlooFZf6pTigDb1ncBXd9YGOYETk=; b=DBLKGRlv1aOGgAQdqxzBTI/xUUzxfgA2FNpr5knAt8X4LUq7XFgAjIu9IsGPV5HysI jEnZrrYZpyWgA/FDVdbJozz6Sme/3iO0vQYsTCLKENYiBjH/JskZG05xDdTuysFa6wNA ocQBpzqxpyGabd5prG+N89pydLapijStTLfl5FM5kRQCEUEJD1Fh26hWgWTO+ary1hg3 +4mfryOkIyuTUuuSv9g8bI45OKrF9DK8wukvdIQLfImTxpCS95ztm1A4ERCOApq8Dm36 MJV+cGXtnq0zpN3i5+5v5odGnOmeUZLEn/NZbHnwQykTOpS3gOQPU25rK2S4v3AuQKZ0 iNYQ== X-Gm-Message-State: AFqh2ko+TY1NW7B9XaViYsDpqGbMyCFwOqR181WUhXrlZtaJo3QVtF8y RHO1H2QDh9/gg057GtrltTbivzGNuJmrot3gDSteZdB7h78= X-Google-Smtp-Source: AMrXdXvE62C0YH6cYdl7aTCLFI+tWNvgReSD8jB23iM+d2GKizs0cK8U2nZ1XSgal0UW2FBjffnkfEZWwlpzKC/1MlE= X-Received: by 2002:a17:907:2c65:b0:7ba:9c18:11e7 with SMTP id ib5-20020a1709072c6500b007ba9c1811e7mr1183577ejc.198.1674142997380; Thu, 19 Jan 2023 07:43:17 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Pier Paolo Grassi Date: Thu, 19 Jan 2023 16:42:40 +0100 Message-ID: Subject: Re: check if coproc has output To: Zsh-Users List Content-Type: multipart/alternative; boundary="000000000000a982d905f29fcaf5" X-Seq: 28665 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: --000000000000a982d905f29fcaf5 Content-Type: text/plain; charset="UTF-8" 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 > --000000000000a982d905f29fcaf5 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I realize now the subject doesn't reflect the final ve= rsion of the mail, sorry for that

Pier Paolo Grassi<= br>


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

long_ru= nning_process | while read line
do
=C2=A0 array+=3D$lin= e
done

problem is, since long_running= _process does not continually produce output but only some times, when i tr= y to interrupt=C2=A0this pipeline with ctrl-c I have to wait until it produ= ces some output for the process to terminate (because, as I understand it, = when it tries to write to the pipe it receives=C2=A0a sigpipe due to it bei= ng 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, but to no result.
I wonder if someone has some solution to share for this proble= m, thanks

Pier Paolo Grassi
<= /div>
--000000000000a982d905f29fcaf5--