在tmux中,如果我用tmux new-window vim
创建一个新窗口,那么在vim
中我启动一个进程(例如:!scite &
),然后我退出vim
(例如:q
),这也将关闭tmux窗口,启动的进程(scite
)也被杀死。我该如何预防呢?
请注意,如果我先使用tmux new-window
创建一个新的shell窗口,然后手动启动vim
,然后执行其余操作,并退出shell,则不会终止该进程。
您要查找的是tmux的remain-on-exit
选项。
from new-window
command:
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.
通过setsid
启动(例如:!setsid scite &
)。