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



> But now I think you mean
>   zsh -> function -> function runs ssh -> ssh runs command -> HUP zsh

Yes.

I am on a Mac, using iTerm. I start a new window in iTerm. It loads my zshrc which includes a function definition that wraps ssh.

If I run "/usr/bin/ssh somewhere" (skipping the function) and then CLOSE the terminal window, the ssh call exits as expected and everything is great.

If I run "ssh somewhere" (which ssh's from inside a function) and then CLOSE the terminal window, the ssh command does not exit, it gets orphaned (ppid=1) and never exits. This causes issues b/c I think the command loses its TTY and it ends up hosing my screen session on the other end of the ssh session. If I kill the orphaned process, screen starts working immediately again.

I was able to reproduce the orphaning behavior with a PHP command so I know that it isn't some weird SSH bug.

Does that help?

Alan



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