如何防止由tmux窗口启动的进程在窗口关闭时被杀死

  • 本文关键字:窗口 进程 何防止 tmux 启动 vim tmux
  • 更新时间 :
  • 英文 :


在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 &)。

最新更新