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

Re: Commands run from functions don't exit cleanly on terminal close (SIGHUP)?

On Oct 25,  9:22am, Alan Pinstein wrote:
} I tried from CentOS but got the same thing.

I tried this ssh'd from CentOS to MacOS (Darwin Kernel Version 12.2.0).

Thu Oct 25 07:29:22 PDT 2012
Thu Oct 25 07:29:24 PDT 2012

So the HUP trap was not tripped, but php exited.  This isn't what I
expected, but on reflection I think it's correct:  php is the foreground
job, so if there is a HUP it goes to php when the connection closes.  The
shell just sees EOF, at which point it would send a HUP to any other jobs
that are still running, but there aren't any so it simply exits.

I get the same thing whether or not the NO_HUP option is set.  This I'm
less sure about, but IIRC the option just prevents the shell from killing
off background jobs when the shell exits, it doesn't actually block the
signal from foreground jobs.

However, note that I closed ssh via the "~." command rather than by
closing a window.  Are you running a local terminal whose command is
ssh, or are you using ssh to run a remote terminal and display it on
your local desktop?  Are you sure the local side of ssh is exiting
when the window closes?

You said your output is:

} Thu Oct 25 08:20:05 CDT 2012
} Thu Oct 25 08:20:26 CDT 2012
} Thu Oct 25 08:20:36 CDT 2012

How are you getting 21 seconds to pass between START and HUP?  Shouldn't
the whole thing run for no more than 10 seconds?

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