Zsh Mailing List Archive
Messages sorted by:
Re: check if coproc has output
- X-seq: zsh-users 28671
- From: Pier Paolo Grassi <pierpaolog@xxxxxxxxx>
- To: Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx>
- Cc: Zsh-Users List <zsh-users@xxxxxxx>
- Subject: Re: check if coproc has output
- Date: Thu, 19 Jan 2023 17:24:11 +0100
- Archived-at: <https://zsh.org/users/28671>
- In-reply-to: <CAN=4vMqvZx4i8HG8ZxCkXYaURes2KezEYZxUAPrZHvXk+6SXtQ@mail.gmail.com>
- List-id: <zsh-users.zsh.org>
- References: <CAP+y1xA95KonZu=c2FKsf7mhTHsFs-B4O4rS4zWhRuV9-UuVKg@mail.gmail.com> <CAN=4vMqvZx4i8HG8ZxCkXYaURes2KezEYZxUAPrZHvXk+6SXtQ@mail.gmail.com>
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:
local cmd=($DOTNET_PRJ/pasteclip/pasteclip.exe $args)
winclip | while etc
shows the ctrl-c problem
zsh (under wsl) is 5.4.2
On Thu, Jan 19, 2023 at 4:34 PM Pier Paolo Grassi <pierpaolog@xxxxxxxxx> wrote:
> Hello, I want to populate an array from a long running process, something like:
> long_running_process | while read line
> 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?
Messages sorted by: