如何防止 tmux window 启动的进程在 window 关闭时被杀死?
How to prevent processes launched by a tmux window from being killed when the window is closed?
在 tmux 中,如果我用 tmux new-window vim
创建一个新的 window,然后在 vim
我启动一个进程(例如 :!scite &
),然后我退出 vim
(例如 :q
),这也会关闭 tmux window,启动的进程(scite
)也会被杀死。我该如何防止这种情况?
请注意,如果我先使用 tmux new-window
创建一个新的 shell window,然后手动启动 vim
,然后执行其余操作,则进程不会被终止,并退出 shell.
您要查找的是 tmux 的 remain-on-exit
选项。
来自 new-window
命令:
When the shell command completes, the window closes. See the
remain-on-exit option to change this behaviour.
set-remain-on-exit
文档:
set-remain-on-exit [on | off]
Set the remain-on-exit window option for any windows first created in this session. When this option is true, windows in which the running pro‐
gram has exited do not close, instead remaining open but inactivate. Use the respawn-window command to reactivate such a window, or the
kill-window command to destroy it.
改为通过 setsid
启动(例如 :!setsid scite &
)。
在 tmux 中,如果我用 tmux new-window vim
创建一个新的 window,然后在 vim
我启动一个进程(例如 :!scite &
),然后我退出 vim
(例如 :q
),这也会关闭 tmux window,启动的进程(scite
)也会被杀死。我该如何防止这种情况?
请注意,如果我先使用 tmux new-window
创建一个新的 shell window,然后手动启动 vim
,然后执行其余操作,则进程不会被终止,并退出 shell.
您要查找的是 tmux 的 remain-on-exit
选项。
来自 new-window
命令:
When the shell command completes, the window closes. See the remain-on-exit option to change this behaviour.
set-remain-on-exit
文档:
set-remain-on-exit [on | off]
Set the remain-on-exit window option for any windows first created in this session. When this option is true, windows in which the running pro‐
gram has exited do not close, instead remaining open but inactivate. Use the respawn-window command to reactivate such a window, or the
kill-window command to destroy it.
改为通过 setsid
启动(例如 :!setsid scite &
)。