zsh-users
 help / color / mirror / code / Atom feed
* check if coproc has output
@ 2023-01-19 15:32 Pier Paolo Grassi
  2023-01-19 15:42 ` Pier Paolo Grassi
  2023-01-19 16:02 ` Roman Perepelitsa
  0 siblings, 2 replies; 11+ messages in thread
From: Pier Paolo Grassi @ 2023-01-19 15:32 UTC (permalink / raw)
  To: Zsh-Users List

[-- Attachment #1: Type: text/plain, Size: 735 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 1105 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-01-19 17:08 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-19 15:32 check if coproc has output 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
2023-01-19 16:33     ` Roman Perepelitsa

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