zsh-users
 help / color / mirror / code / Atom feed
* Implicit killing of subprocesses
@ 2013-08-28 12:54 René Neumann
  2013-08-28 13:02 ` René Neumann
  2013-08-28 13:26 ` Peter Stephenson
  0 siblings, 2 replies; 9+ messages in thread
From: René Neumann @ 2013-08-28 12:54 UTC (permalink / raw)
  To: zsh-users

Hi,

I have a question regarding if and when subprocesses are killed when
exiting a shell script.

My case: I want to pipe the output of a longrunning process (here:
dbus-monitor) through some evaluation. As it does not read from stdin, I
can't simply close it by sending EOF.

When I use

coproc dbus-monitor
while read -p line; do ... done

the dbus-monitor process lurks around after the script finishes
(breaking or returning from the loop).

When I use

dbus-monitor | while read -p line; do ... done

it does not (i.e. it gets killed).

My questions now are:

- Can I build on the process being killed when exiting the loop (in the
second case)? Or does it only work in some cases?

- Is it intentional that coprocs don't get killed and I have to make it
by hand? (Which is hard if you have "coproc dbus-monitor | grep ...", as
$! only holds the grep).

Thanks and regards,
René


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

end of thread, other threads:[~2013-08-29  0:20 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-28 12:54 Implicit killing of subprocesses René Neumann
2013-08-28 13:02 ` René Neumann
2013-08-28 13:26 ` Peter Stephenson
2013-08-28 13:38   ` René Neumann
2013-08-28 13:47     ` Peter Stephenson
2013-08-28 15:59       ` Bart Schaefer
2013-08-28 16:11         ` Peter Stephenson
2013-08-28 16:27           ` René Neumann
2013-08-29  0:20             ` Bart Schaefer

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