Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: check if coproc has output



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
> 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.




Messages sorted by: Reverse Date, Date, Thread, Author