From: Pier Paolo Grassi <pierpaolog@gmail.com>
To: Roman Perepelitsa <roman.perepelitsa@gmail.com>
Cc: Zsh-Users List <zsh-users@zsh.org>
Subject: Re: check if coproc has output
Date: Thu, 19 Jan 2023 17:24:11 +0100 [thread overview]
Message-ID: <CAP+y1xA9h9T=0QZ4aUHj2mytzzb8bOcR9-wO=kADZ=mQ1_APNw@mail.gmail.com> (raw)
In-Reply-To: <CAN=4vMqvZx4i8HG8ZxCkXYaURes2KezEYZxUAPrZHvXk+6SXtQ@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1618 bytes --]
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 <pierpaolog@gmail.com>
> 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.
>
[-- Attachment #2: Type: text/html, Size: 2677 bytes --]
next prev parent reply other threads:[~2023-01-19 16:41 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-19 15:32 Pier Paolo Grassi
2023-01-19 15:42 ` Pier Paolo Grassi
2023-01-19 16:01 ` Sebastian Gniazdowski
2023-01-19 16:08 ` Pier Paolo Grassi
2023-01-19 16:09 ` Sebastian Gniazdowski
2023-01-19 16:13 ` Pier Paolo Grassi
2023-01-19 16:36 ` Sebastian Gniazdowski
2023-01-19 16:53 ` Pier Paolo Grassi
2023-01-19 16:02 ` Roman Perepelitsa
2023-01-19 16:24 ` Pier Paolo Grassi [this message]
2023-01-19 16:33 ` Roman Perepelitsa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAP+y1xA9h9T=0QZ4aUHj2mytzzb8bOcR9-wO=kADZ=mQ1_APNw@mail.gmail.com' \
--to=pierpaolog@gmail.com \
--cc=roman.perepelitsa@gmail.com \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).