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 4322 invoked from network); 19 Jan 2023 16:41:09 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 19 Jan 2023 16:41:09 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1674146469; b=U4Gkid5DzCYzYzFaqP/Wjcm+5PRuxHFe1pGg6ekhqngxt8R2mSlv+pT1vLcgsH7R0AQPpJR1b2 4BsCUjztFYl4aAA9zAaD0fF7CP0dHVKhGMg2Z7VfdiheQhha4xMdZTVEaw8vJujZDu/kStak8Z Uxv+3oJajoSagHpFgolSbJteBWm2KkF6OGE3iSM/xcQzcQWA+6fDTaetP4eOdsxElwrDcfY2wK JMUK/ok22+i7kvofmCGnjw1eUEyPpA8oSzm3Z8t7bG3LlnimbA+MItlV5dUJxRCpfHsYc2bVdM c0Rmf8PQxt/ACFiCqh6lrXrDdzy+eFeIL1v6VmvFiPTuQA==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-ej1-f43.google.com) smtp.remote-ip=209.85.218.43; 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=1674146469; bh=m54gVMGI16xnhbZF9IA32EiaOtfRE0jhZAhno1xAhEI=; 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=TWdyvp14Ucxi7DwJH/aMFXzeFjD2XGYvTGLx5e0I6Ip9x3PhsDPxXUFzPm7un64G32YsLEnzg5 9cMT2TaujO7SPrmUjwBhC1p5DFBxgzEzWEhDp+3QAYyWNmOJKC+0EVI+2yNmkHhe/cXlH74AfK caORVU49jMFKN7Rq/e+Iu0wqvKM3mI2ci96Lp6H5Zu0pVgRNa+5f+M6ub/qLsQtV9eCOJTcH9i 3AUw7XBJ8QdPfNvFLhHeQhfrqg6TKjOnKRzIB2uVX2O+a5gKJiZonLKwOr0Cz+v5E4dkRlj6TW lh3KredzhFeKd89e5iKKqBWfxJ7nkU1/g5Wl6CgE8d7vFg==; 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=R3KTzNTckVDd3DImXp5adAsQ8bXjXGvsMib3b2/vhCI=; b=kCvk3RGT6VKLMbJOhZ+Fs6G8qK wF0CY6rh9VKBEbS1ZL7w9Isncn4SD/58XAlp/EgtKZLSwk1M/podt6+BQvhypPefxZv2etKzwqAKV lWd3+lj3PrcVMXQ+n2ZfIGvV0mTejTfmdLaq3rreCPjt91cQNUxvlNjtvJoCYLnH/jLwIftBTV59p iP7Tn+XfAUjOdwhd6mIRMS7+0ngyTqQwMlzqFteO7VGMAtzLXkmPaOOHmql4Du1qJXt/Pb6WDgUPC hrX1ieFIu2y4FVNUSdfuOy7o8jbmrpc9hiPvLfPdccLailnUaTYH/06N6JBKvCGKXD69WQGdHXpHc gMOeQiRg==; Received: by zero.zsh.org with local id 1pIXyO-0009LZ-Vq; Thu, 19 Jan 2023 16:41:09 +0000 Authentication-Results: zsh.org; iprev=pass (mail-ej1-f43.google.com) smtp.remote-ip=209.85.218.43; 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-f43.google.com ([209.85.218.43]:38518) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1pIXia-0004zS-E4; Thu, 19 Jan 2023 16:24:49 +0000 Received: by mail-ej1-f43.google.com with SMTP id mg12so7075928ejc.5 for ; Thu, 19 Jan 2023 08:24:48 -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=R3KTzNTckVDd3DImXp5adAsQ8bXjXGvsMib3b2/vhCI=; b=d4JaZD/yw9rPUgLkFVCQL996+Ub2Dr8cDoXMclPV6htKz8xnZ7/gIYOb/wB0EA5R78 IB99kJ1/xwD0T57BwbJ72qzdIgcCnEHbbQz9jYC8bg5cH4fQWbrZWvVGrvVULNme4TLR dufyYxjFAL14cxkbBNC7BRn06mXlXCJeN2n3jIldnNRnagBNt4p9m3TcoMcwED6Rib9u wuPUso4ZZv5ZLQKE3jcBKqUOvWxvHIeqlbt9pDRpOpsWHC1m7V/S1pGjV7BjSA+aVDZJ gM/+mKNBD/UMeWmYeCQgoN3/lbfLmHdKNZlD/qfyt+eYk7RX5YFI0DIbtxdNPp8SSaAA zY+g== 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=R3KTzNTckVDd3DImXp5adAsQ8bXjXGvsMib3b2/vhCI=; b=nHbpuI2AbqUWC+JCQoHtJdQHR9Qv7YZRmfnbzDp/N6BzpgEHweN1OUN5o747PMrwoB 6F5Vc0Drx9BYbinn2KCqPRGckobQn3u+Lna2X3rVd30Z1RK4F/bnIoaLLw4jGKxMXte6 Dbt5S8x5Xq+3qpIv6YlcOtoCWX4k/vOg+wnFOettyM6dz5Xtj19l7Wi4dlfei3rjAjTu hsq16RjmP7z/LjmAiEqiE5ZWJl32lZpGAiNDFGR2D1N29cOkwiC3qNNa1efUqsZwl6Gp C44Xo/Lf/DjpqU+Rmq9dQfDvBs+oWaAtLeoE7DDj/AAcdIkORrpgwbs4bmzIphmMOUx9 V86g== X-Gm-Message-State: AFqh2ko6WTBz/xaIyK6LYxhNU+UFW5+LO4ur0uhvCj2M20JkziQItOIO 3yDDJhyK7Ei3tpeblI4mM+REPRsnBew4WenzdojgTcZGgAPtvg== X-Google-Smtp-Source: AMrXdXu4cDkidSRplSaQUEtGj5VR/N2siPL5l0h2e1ClolAKoX3BqG397fPK6+LgQrgHKrkPSq2w10wDHFzZGv3hXzo= X-Received: by 2002:a17:906:2291:b0:85c:579b:7506 with SMTP id p17-20020a170906229100b0085c579b7506mr721047eja.646.1674145488093; Thu, 19 Jan 2023 08:24:48 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Pier Paolo Grassi Date: Thu, 19 Jan 2023 17:24:11 +0100 Message-ID: Subject: Re: check if coproc has output To: Roman Perepelitsa Cc: Zsh-Users List Content-Type: multipart/alternative; boundary="0000000000001ec7f805f2a05f6b" X-Seq: 28671 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: --0000000000001ec7f805f2a05f6b Content-Type: text/plain; charset="UTF-8" Hi Roman, I do not. I cannot even strace the process because it is an .exe invoked from a windows wsl environment, but it shouldn't be a problem regarding the handling of the int signal, other scripts I made in the same manner handle it properly.. I haven't mentioned this in the first place because I had similar problems in the past with pure linux pipelines. I have now discovered this: if I invoke the .exe directly, eg: long_running_process.exe | while etc the ctrl+c is handled correctly, whether if I enclose it in a function like this: winclip(){ local cmd=($DOTNET_PRJ/pasteclip/pasteclip.exe $args) $cmd "$@" } doing winclip | while etc shows the ctrl-c problem zsh (under wsl) is 5.4.2 Pier Paolo Grassi Il giorno gio 19 gen 2023 alle ore 17:02 Roman Perepelitsa < roman.perepelitsa@gmail.com> ha scritto: > On Thu, Jan 19, 2023 at 4:34 PM Pier Paolo Grassi > wrote: > > > > 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) > > When you press Ctrl-C, zsh sends SIGINT to long_running_process. > Ideally, it should honor the signal and terminate. Do you know why it > doesn't do that? > > Roman. > --0000000000001ec7f805f2a05f6b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Roman, I do not. I cannot even=C2=A0strace the process = because it is an .exe invoked=C2=A0from a windows wsl environment, but it s= houldn't
=C2=A0be a problem regarding the handling of the int signa= l,=C2=A0other scripts=C2=A0I made in the same manner handle it properly..
I haven't mentioned this in the first=C2=A0place because I had= similar problems in the past with pure linux pipelines.
I have n= ow discovered this:

if I invoke the .exe directly,= eg:

long_runni= ng_process.exe | while etc

the ctrl+c i= s handled correctly, whether if I enclose=C2=A0it in a function like this:<= /div>

winclip(){
=C2=A0 local cmd=3D($DOTNET_PRJ/past= eclip/pasteclip.exe $args)
=C2=A0 $cmd "$@"
}

doing=C2=A0

winclip | while etc

show= s the ctrl-c problem

zsh (under wsl) is 5.4= .2

Pier Paolo Grassi


--0000000000001ec7f805f2a05f6b--