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



(Alan, your previous message went only to me, not to zsh-users.  I'm using
the list for this response.)

On Oct 25, 11:10pm, Alan Pinstein wrote:
}
} # on CentOS
} Interestingly if I "kill -HUP <pid>" while it's running, I get this output:
} 
} Thu Oct 25 22:09:26 CDT 2012
} START
} Thu Oct 25 22:09:34 CDT 2012
} DONE
} 
} It doesn't log the HUP for some reason.

Which PID are you hupping?  The php job, or zsh?  On MacOS, I get the above
if I HUP php.  If I HUP zsh, I get

Sat Oct 27 10:47:42 PDT 2012
START
Sat Oct 27 10:47:46 PDT 2012
HUP
Sat Oct 27 10:47:54 PDT 2012
DONE

which is what I'd expect because zsh won't pass the trapped HUP along to
it's child processes.  If zsh actually exited, it would HUP the children
(assuming NO_HUP is not set), but it did not exit, because of the trap.

In the case of the window closing, php should get the HUP, because it is
the foreground job.

Here's a question we haven't asked yet:  What version of zsh are you
trying this with, in each case (MacOS/CentOS)?  I've been testing 5.0,
but if I try closing ssh with ~. when using 4.3.11 as shipped with
Mountain Lion, I get entirely different behavior; neither HUP nor DONE
is written to the file, only START -- but both php and zsh have exited.



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