当我在tmux窗口中退出prossess时,tmux窗口退出

And*_*tad 3 tmux

如果我有一个类似的进程,rails c或者guard我退出命令退出,那么tmux窗口也会退出.

当我只想重新启动例如轨道控制台时,这不太实用.

我可以在tmux中阻止此行为吗?

Chr*_*sen 6

您可以设置remain-on-exit窗口选项以防止tmux在运行它的进程结束时关闭窗口(窗格).

setw remain-on-exit on
Run Code Online (Sandbox Code Playgroud)

会话选项set-remain-on-exit也可用; 使用它,您可以安排会话的所有窗口/窗格自动remain-on-exit打开.


一个后remain-on-exit面板的过程结束后,面板会显示消息"窗格死了",直到它与命令关闭kill-pane(或kill-window),或一个新的命令与在那里开始respawn-pane(或respawn-window).

respawn-pane 'rails c'     # respawn with a specific command
respawn-pane               # respawn whatever the previous command
Run Code Online (Sandbox Code Playgroud)

If you are not overly concerned about cleanly exiting a pane’s existing process, then you can even restart a pane without first exiting its current process like this:

respawn-pane -k            # kill current process (if any) and respawn the previous command
Run Code Online (Sandbox Code Playgroud)