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

Re: Implicit killing of subprocesses



Am 28.08.2013 18:11, schrieb Peter Stephenson:
> On Wed, 28 Aug 2013 08:59:52 -0700
> Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>> On Aug 28,  2:47pm, Peter Stephenson wrote:
>> }
>> } In this case, the NOHUP option is irrelevant --- because you don't have
>> } job control (it's determined by the MONITOR option which is unset in
>> } non-interactive shells), the shell doesn't send SIGHUP to processes on
>> } exiting (without job control it doesn't have much idea of which
>> } processes would need it).  So I think you get the effect you want.
>>
>> I think the effect Rene wants is that the coproc job DOES get killed when
>> the script exits?
> 
> Oh, right.
> 
> 
> coproc cat
> coproc_pid=$!
> 
> TRAPEXIT() { kill $coproc_pid }

Gets problematic though with

coproc cat | grep foo

as $! now only holds the PID of grep.

- René



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