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 310 invoked from network); 19 Jan 2023 16:08:29 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 19 Jan 2023 16:08:29 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1674144509; b=BcL6tI2YjYZw/2oEOE4Ifvgcb8g9QJj7MQYUAbXGJcrkr/XQZy5H90HRDJJmH5zHgrpENYOg5s 396q8GN+P7OA7x3PVVruIjBjae7NHSluQM2D9YTyTXUuDZsJBM9gAojE6jVKCk7x9bP1NVFXvZ uRZdyR0rHpXPNm1QNCnfaEXaTOXxFl1LXWP9uhttcQTtKKPjDCpJCzsDp10P4yMPQGadw0kHIK 36LnqlBqKHlsflw1MrPny8DNUQUDUUf24/pl3bkIiOEdjqN/mps7mLSK6H+gnPCMUJVuyoR2Tc qahyp9vjOg1Gunuj6kByuP6KpZsXUPvfySXjp+pLktwQYg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-lj1-f170.google.com) smtp.remote-ip=209.85.208.170; 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=1674144509; bh=3gR1ti+ckCTNOsnQrMskUtV2Do9EKNTQqCQgcl+YJ2s=; 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=P0/CloFk0OPnArMW0cCsEEHMJXCRdz0H5c4gefAmGMIWS2k/BsQbBW8QSv4TxUG+n4qFExPh6V wpH2QOGcFwHyYFvS/MotOEVt5gS7EFQ0uZo3+SMZzpgobgbU4mxxmRyVF/fRU6B7v0hw23y/z0 QzvYGqe3pf9uMVQiSYhVB3iPug0n5YaUQJ0vBB1HVR9zAitd9bs78N8LunkwKjFXv0bSJvMS3a ZV/zWR436jOAucR3UtvWta/yxFUmvjA+C9OQK3SDZP5AITsMVj0b6yKQZ9hwCYAyUPLdFy5NIH yEtLZWz7Qmb+/uHXpvozIpt3uvvv+thg/KRYf7E9vXXvcw==; 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=XiURgKdI8Mwnl4lRWhByLpknlnB1RN9kplXD66wH7AE=; b=Eed37Fbsku606BMlQ6lCzdiIr9 n7Hdes0Hb6kNZ9+Qv1BZS+XCAz92/e+MYgheorsLW5FRmdAD8g/FyWGqUEDyI+WrSDL/6vJF44c7H PelF/gyAMdiIXs+CD+e9oUa47kgdyeI/sZCJjTRNqxgwxcCBwkZcdy144vaFbKKNcH/B2zh5RXd9N DyZRB9uNIgBqzrOEZ/anBHiUt55t0HTJlfRmphe+Po1/SjVuBN8xQLoIQkXFlm+FDQm/VUEGT+u2p q5UBHC2gtS/aIKzqNvJmT1Bfkzaym6QCKOibPFF+0ox07W6UZhgddNGUFDLXzdINghDd6ktLr07vo F3vPv9EQ==; Received: by zero.zsh.org with local id 1pIXSn-0002IG-4X; Thu, 19 Jan 2023 16:08:29 +0000 Authentication-Results: zsh.org; iprev=pass (mail-lj1-f170.google.com) smtp.remote-ip=209.85.208.170; 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-f170.google.com ([209.85.208.170]:45741) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1pIXMb-0001R4-Mc; Thu, 19 Jan 2023 16:02:07 +0000 Received: by mail-lj1-f170.google.com with SMTP id p25so2547192ljn.12 for ; Thu, 19 Jan 2023 08:02:05 -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=XiURgKdI8Mwnl4lRWhByLpknlnB1RN9kplXD66wH7AE=; b=MWc4+aFEjWgRbthcyUb8sUmie0FX5ovBJKzePqCnEpgVKK4ZWqTLE59GNSHIGhtPIG 1TguFCxl00XUFPUAnpmAi4hwMi8EwyXgXd0LtmX5sVAy2lpfSH6djb16EKExN2pKpZr4 E0k02FXUt/LZUfc+l2ZT84iNUvt6+2VxeieOU3dLKM5yI6TUjLPmAYM2SvPdLIqbIkFO yOQclrs6Ev1JWDt4g49RuNbU+fP9jChzWoqLr65l5S5SZ8noN2kukYgSoCWDpVQsa2Q/ PYdxESYF29XpRgJ6boGZF7JobeHPLJiKNqy/ZbRaWE5e4GpjXia+EOCJTCZoa7+YLdQd ZvwQ== 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=XiURgKdI8Mwnl4lRWhByLpknlnB1RN9kplXD66wH7AE=; b=gz+JHsL8iHcDb0rSQbkKRjRQjhe2bq96ceZbH9Pd2ca/nqlvEMEUxxCsp9r2tRj6BP Efy+QZSCZZr4NqpKS8rmH/U8LTtsMGXa2Bg6WgpS2CdZKFw1EL9Z0Sw8BZDJmNmyRrq3 g6Sfn2GqyrXf0OqrJE9NFyNecr8YW5FUk86Dw6Y/eJqgJuqnRPmkkuBrH5Pf7F9bF1C2 tu7kVEXtcz3KRtaa7yOFFtNx2ndkfxccXX5D4NEM9HYJ+UqUKKioo/9sN92ybbLEF56M 3AvhEug87tpuuk3OPAbNDAq94uMPo6x3Bo+E193UmW46/ou16zHoIwhW5A8jmT22yosx a74A== X-Gm-Message-State: AFqh2kru8L7W9+sz38Ffpb4eS85L50MRx4/NWn5bYB9ntf6594hgU3vb V+4lCqZur9QhUQqgq+Tw/LoMsjfu5evi/R+nXFE= X-Google-Smtp-Source: AMrXdXuPo0D+HxKs10h5AykqHkNvv1OncBsmn9cioAR0ZxFxXgneXNWbEk/2TMZhwS/Upq0Yre8L51NOBgd676RZP5A= X-Received: by 2002:a2e:994e:0:b0:289:da59:6cd0 with SMTP id r14-20020a2e994e000000b00289da596cd0mr813075ljj.298.1674144124774; Thu, 19 Jan 2023 08:02:04 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Sebastian Gniazdowski Date: Thu, 19 Jan 2023 16:01:38 +0000 Message-ID: Subject: Re: check if coproc has output To: Pier Paolo Grassi Cc: Zsh-Users List Content-Type: multipart/alternative; boundary="000000000000dc2cab05f2a00d25" X-Seq: 28666 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: --000000000000dc2cab05f2a00d25 Content-Type: text/plain; charset="UTF-8" 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 --000000000000dc2cab05f2a00d25 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
You could get pid from $jobtexts?

On Thu, 19 Jan 2023 = at 15:43, Pier Paolo Grassi <pie= rpaolog@gmail.com> wrote:
I realize now the subject doesn't ref= lect 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 Grassi <pierpaolog@gmail.com= > ha scritto:
Hello, I want to populate an array from a long running pr= ocess, something like:

long_running_process | while read= line
do
=C2=A0 array+=3D$line
done
<= div>
problem is, since long_running_process does not continua= lly produce output but only some times, when i try to interrupt=C2=A0this p= ipeline with ctrl-c I have to wait until it produces some output for the pr= ocess to terminate (because, 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 c= oproc to be able to intercept the=C2=A0ctrl-c and send a sigpipe to the lon= g running process, but to no result.

I wonder if s= omeone has some solution to share for this problem, thanks

Pier Paolo Grassi


--
Best regards,
Se= bastian Gniazdowski

--000000000000dc2cab05f2a00d25--