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

killing commands in a pipe?



I have a problem with a shell script:

  #!/usr/bin/zsh
  setopt NOHUP
  some_command_that_never_exits |
  while true; do
    read LINE
    ...
  done

I start the script from another script with

  my_script &

and I try to kill it with

  killall some_command_that_never_exits

The problem is that although some_command_that_never_exits is
killed as expected, the 'while' part of the pipe doesn't exit.
Actually it's worse than that because the zsh running the command
refuses to be killed, even with kill -9. If I unset the NOHUP
option instead:

  unsetopt NOHUP

it works ok. The manpage says this about the (NO)HUP option:

  HUP    Send the HUP signal to running jobs when the shell exits.

So this doesn't explain the behaviour. Shouldn't the pipe exit
completely when the input stream is broken, regardless of the
HUP/NOHUP option?

I am using zsh 3.0.5 u'on a Linux 2.2.5 kernel.

(please cc me, I'm not on the list)

Bye

Dominik ^_^

-- 
Dominik Vogt, Hewlett-Packard GmbH, Dept. BVS
Herrenberger Str.130, 71034 Boeblingen, Germany
phone: 07031/14-4596, fax: 07031/14-3883, dominik_vogt@xxxxxx



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