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

Re: Background task gets killed while closing zsh. Why?



> I have defined a suffix alias for pdfs:
>
> alias -s pdf='acroread'
>
> Now I call a pdf:
>
> test.pdf &
>
> As far as I understand this is expanded to:
>
> acroread test.pdf &
>
> Now acroread gets called and shows the pdf. Now I logout of my zsh, but in
> this case also acroread gets closed. When I was using bash as my shell, I
> was able to call something as a background job from bash and close bash
> without closing the job. What am I doing wrong with zsh here?

This is zsh's default behaviour. It ensures that you have no dangling
processes that you are not aware of.

If you want zsh not to SIGHUP the running children when the shell
exits, you have as far as I know four possibilities :
- Run your command with the no_hup command prefixed.
- Use &! or &| instead of &.
- Use disown on the job number while it's running.
- Change the value of the hup option with something like 'setopt
no_hup'. This will stop the shell from sending HUP to the running
children on exit in a (default) bash-like manner. If you choose this
solution, you may want to also disable the check_jobs option to stop
the shell from warning you there are running jobs, and of course put
that into your startup files.

I personnally hate the bash-like behaviour because I find I lack
control over the sessions and use the 2nd and 3rd possibilities I
listed here, but the choice is yours.

--
J
"Toi, je te trouve pas la même tête que sur la page précédente" -- Wakamiya


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