本文介绍了zsh的出口,但离开运行的作业打开?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

只是切换到的zsh从庆典。

Just switched to zsh from bash.

这是(使用海豚是一个随机的例子)的bash的行为:

This is bash's behavior (using dolphin as a random example):

$ dolphin .
^Z
[1]+  Stopped                 dolphin .
$ bg
[1]+ dolphin . &
$ exit

所以离开海豚运行。

So it leaves dolphin running.

这就是我想要作为默认行为。

That's what I want as the default behavior.

相反,这是zsh的行为:

By contrast, this is zsh's behavior:

 % dolphin .
^Z
zsh: suspended  dolphin .
 % bg
[1]  + continued  dolphin .
 % exit
zsh: you have running jobs.
 % exit

因此​​,第一警告我已经运行的作业。

So it first warns I have running jobs.

然后,如果我输入退出再次,它关闭了海豚窗口。

Then, if I enter exit again, it closes the dolphin window.

我如何做的zsh的默认行为,喜欢这里的bash的?

How do I make zsh's default behavior here like bash's?

推荐答案

从:

HUP

...在zsh的,如果你在运行shell退出时,后台作业时,shell会假设你想,要成为杀害;在这种情况下,它被送到所谓的特定信号 SIGHUP ...如果你经常启动应该去,即使外壳已退出工作岗位,那么你可以设置的选项 NO_HUP 和后台作业将被单独留在家中。

... In zsh, if you have a background job running when the shell exits, the shell will assume you want that to be killed; in this case it is sent a particular signal called SIGHUP... If you often start jobs that should go on even when the shell has exited, then you can set the option NO_HUP, and background jobs will be left alone.

因此​​,只要设置 NO_HUP 选项:

So just set the NO_HUP option:

% setopt NO_HUP

这篇关于zsh的出口,但离开运行的作业打开?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-01 15:46