How to prevent processes launched by a tmux window from being killed when the window is closed?

时间:2015-09-28 13:11:58

标签: vim tmux

In tmux, if I create a new window with tmux new-window vim, then in vim I launch a process (e.g. :!scite &), then I exit vim (e.g. with :q), which will also close the tmux window, the launched process (scite) is also killed. How can I prevent this?

Note that the process is not killed if I use tmux new-window to create a new shell window first, then manually launch vim, then do the rest, and exit the shell.

2 个答案:

答案 0 :(得分:1)

您正在寻找的是tmux的remain-on-exit选项。

来自new-window命令:

  

当shell命令完成时,窗口关闭。见   保持退出选项以更改此行为。

set-remain-on-exit doc:

   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.

答案 1 :(得分:0)

改为通过setsid启动(例如:!setsid scite &)。