I am scripting tmux version 1.4 and trying to open new windows as follows:
tmux new-session -d
tmux n开发者_如何学Cew-window ifconfig
tmux list-windows
0: bash [80x23] [layout b85e,80x23,0,0]
1: ifconfig [80x23] [layout b85e,80x23,0,0] (active)
tmux attach
... no output
I expect the output of ifconfig to appear in the window 1, but nothing shows up. I have the line set-option -g set-remain-on-exit on
in my ~/.tmux.conf file as well.
If I run some other command, sometimes the output shows up:
tmux new-window "curl www.google.com"
tmux attach
... lots of output
By trying out different commands, it seems like very long outputs are shown. Short outputs don't appear.
This happens only in Linux. If I try it on Mac OS X, built with the same tmux version, things work as expected.
Any ideas?
Thanks,
This sounds weird.
Is the ifconfig output in the tmux history? (C-b [ and page up)
Is the terminal you attach to much smaller or bigger than the default 80x24 that tmux 1.4 will use for new unattached windows?
Also try killing tmux entirely and restarting with export EVENT_NOEPOLL=1 in the environment.
If you didn't already figure it out and none of this helps might be best if you mail nicm at users dot sf dot net or the tmux-users mailing list.
If you pass a shell-command to the tmux new-window command, it closes the pane and the window as soon as the shell-command is done running.
Also, I have run across cases where setting the global set-remain-on-exit option did not work as expected.
Try running a command that doesn't exit, like top
.
tmux new-window 'top'
Also, try starting a new shell after running your short-lived command.
tmux new-window 'ifconfig;bash -i'
References:
Prevent pane/window from closing when command completes - tmux
How do I get tmux to open up a set of panes without manually entering them?
精彩评论