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 28543 invoked from network); 19 Jan 2023 15:34:11 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 19 Jan 2023 15:34:11 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1674142451; b=bewU+Iz+cnYqHMf2ScaaeUhMnjUSZ3LdONRSHLN0u1WaPHQKs6bZMjfs9V0PDBHieWDOtOqk6n ngQx6IRF0pu8Igx6UVByVHMDseFzU39y0X1NeKsdqiDxBQATAveBh0Pbz8aAzf4Fz4MEe7UCTk c8eouzmVaGG3e1S0hk1E8HLrrcYx8DkpKdMNigLkXZid0cqVerM0ib+NFj8GFau1/gvodI9156 T1J0qcfsyQ17YVWRW3POs5jJeNBcp8OqeBKygbuv9GLH3EZlYPWpVTEE6A59cdn9CFcpsKUlUf CT4oh+un4n9aTYVmy/EnRjJRmzq5+LcAEUnYYiJefbUPog==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-ed1-f50.google.com) smtp.remote-ip=209.85.208.50; 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=1674142451; bh=jq/uNnTXXmd1t7mn1UYKKP3k8Zsb+JLY0vbtTU+MNdA=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:To:Subject:Message-ID:Date:From:MIME-Version: DKIM-Signature:DKIM-Signature; b=srwo+t6mW31loxA3fayQoj3dNp7QsAgmf2BsSnHWxzp80Of2sFhjYl6ko8Q2Oim4eWUiIVoo4Q hBUanLqAtTLJTilSop5XqZd0tQqehZURvTiTQ5uR3jYNbtUMXQkis20oe2sqdTao+Wrdy1grvD O4AW20kC192CUe5cO5O59y0YnDOX/6H9CeROYebW/EI6yBD4f3qmYndaPAWny4K0/aV1GJJAHI 2hjsCraHxFaRf6DWCCgEdT7iGOLEQDWV1VFuqPoDa7tsCRz9ITP5pzKFkzd/5L7BWSuqv5VcYt 58uEKJJ+FUU02SVQTkSgNPhOsMdvnFta9OmpgX0tvccIZg==; 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: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:In-Reply-To:References; bh=Ku/1pKX2FOthNczBRfqdQMGAJ3O1VXuHFk1Fslsl+H4=; b=S9SGv5zolszM4TA0Ux9gsniDDs dqhra+Wh0Q+eEaLqH2COGp48U8xttePk3AJYRfsYOaivlxCFG+9TJA2E/64vTXA0egTFMX+xLM+mY VafrAQriQATxNLd6NnU3KquxDT8oye0l/5Tb/hw64jN1RZCQ/rCt2T9asa88cJuAxxsiphZXCyTdI aQtl4F8+k0RU0JUh3o13L0zOCFAtVKUgsd3T4/1KreMzlWeFYjB4zswqOOY9juuaJJWS/K3Xf9njX 0FOjvm6rM0jqK0gpkm1f1y4qrTuOiEcqI9DCGuDsGwOmczN1OSAId0tlMY+ttLvLm9cR2ePRUboNG ZAhjqZMA==; Received: by zero.zsh.org with local id 1pIWvb-000P8H-Ni; Thu, 19 Jan 2023 15:34:11 +0000 Authentication-Results: zsh.org; iprev=pass (mail-ed1-f50.google.com) smtp.remote-ip=209.85.208.50; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-ed1-f50.google.com ([209.85.208.50]:42763) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1pIWv2-000OSX-Dx; Thu, 19 Jan 2023 15:33:36 +0000 Received: by mail-ed1-f50.google.com with SMTP id v30so3299299edb.9 for ; Thu, 19 Jan 2023 07:33:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=Ku/1pKX2FOthNczBRfqdQMGAJ3O1VXuHFk1Fslsl+H4=; b=inmJv8uU3UYvhCFF/NJve0Yeuo3r2Zc6cOx23jhwLtzLsE9UFOBZfvC6Qyi2vmyyyV G9sbjGXO98R2+q6fWw0Qjb/pKh1V8ha65FL4th5CqB7T0/TDgMgidyxDxApvzmnk7W9p LsRtwynEBCrkJnAFOE0UaROJAM3g1RHkqrJrryOpA+PpvdWXqB4vD95B4GDUkWP+MZJS cHurNepNk3zycyqhBRcsmIPelSLZlIdPOakmf0oJfB9LP83siIhX1xV9P/oHwdqKPh8G ec0jReND0s3WKOx8eFew8pQY9V0bRTsulwfcNRnhNoONj4CI9XaDj1zB1sHluRkgJVXP KvKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=Ku/1pKX2FOthNczBRfqdQMGAJ3O1VXuHFk1Fslsl+H4=; b=6DvKmSXObokpVd9bymvws5k2mE0mifungOXYdMIw3c74kA+DZkkeJZ+VwWBye4DjTj UKSBsbVW7oLZjGzXwr71HPlqHnjwN1wed2Hu7B+GEKDhKpB2b1+8siU3H+ViVgDcgp1r bplugm3pwFFz+O2N1rkuBTX1ii3WwLFl3b2MgYIQaZrCMJHgX2RrPCoY4a5VnuW4+Rx+ SX0DOLikGobgsdVkoJMHs3ujjSPZaWgzxTP0gpW+Kc+0zCwnC1XCUJ4uQHUMB88v55RM wMbzeaiKtTSxV52VF8RZ5SSPUUvdNQGeej43aLs3nZZULft3LR6K8Tww3Pe5Ou6oSgA7 Ie1Q== X-Gm-Message-State: AFqh2kru3YJ+9qAWhqIQJZi/D9MmAZeViSgLhZ/xjIaIwVfaKRtMgs2N 4Yhs7pA6xwSLxZ0D8dS/ewPzEru666pVf10fkZY2A32qa18YBQ== X-Google-Smtp-Source: AMrXdXu7QDSV8vFY73MRS+4aZQffb0uJPtTxSbbUWW/+Ud7Q+1XGVT0weITaYtrYumw30Ml1oAQWepJO8d5vcydTPac= X-Received: by 2002:a05:6402:10c4:b0:495:5309:1fb3 with SMTP id p4-20020a05640210c400b0049553091fb3mr1087222edu.111.1674142415589; Thu, 19 Jan 2023 07:33:35 -0800 (PST) MIME-Version: 1.0 From: Pier Paolo Grassi Date: Thu, 19 Jan 2023 16:32:58 +0100 Message-ID: Subject: check if coproc has output To: Zsh-Users List Content-Type: multipart/alternative; boundary="000000000000fc1f7605f29fa790" X-Seq: 28664 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: --000000000000fc1f7605f29fa790 Content-Type: text/plain; charset="UTF-8" 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 --000000000000fc1f7605f29fa790 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello, I want to populate an array from a long running pro= cess, something like:

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

problem is, since long_running_process does not continual= ly produce output but only some times, when i try to interrupt=C2=A0this pi= peline with ctrl-c I have to wait until it produces some output for the pro= cess to terminate (because, as I understand it, when it tries to write to t= he pipe it receives=C2=A0a sigpipe due to it being already closed)

I have tried various constructs with trap=C2=A0and even co= proc 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 so= meone has some solution to share for this problem, thanks

Pier Paolo Grassi
--000000000000fc1f7605f29fa790--