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

Re: GNU nohup oddness

On Dec 5,  7:30pm, Clint Adams wrote:
} nohup ./zshscript &
} <Ctrl-D>
} <Ctrl-D>
} Does anyone know what's going on here?

The problem seems to be a combination of three things:

(1) The HUP option is set by default.
(2) When HUP is set, zsh _explicitly_ sends SIGHUP to process group
    in its job table on exit, rather than rely on the tty driver to
    do it when the tty is hung up.
(3) In Src/init.c:init_signals(), zsh explicitly installs a SIGHUP
    handler, even in non-interactive shells.  It has done so for a
    very long time -- as far back as recorded in my CVS of 3.0.x,
    which means prior to 27-Jun-97.

That last one is the real culprit, because it means that jobs started
as part of the script inherit the SIG_DFL handler from the #! zsh,
rather than inheriting SIG_IGN from the nohup great-grandparent (it's
"great-" because `nohup' runs `nice' as the grandparent).  So even if
the script does `setopt nohup', the top-level shell's process-group
kill will hit all the children of the script.

Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   

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