3

I'm using iTerm 2 nightly and I have the following tmux config setting for the left status bar:

set -g status-left "#[fg=green]#h @ #[fg=cyan]#(extip | awk '{print \"ip \" $1}') #[fg=yellow]#(ifconfig en0 | grep 'inet ' | awk '{print \"en0 \" $2}')  #[fg=red]#(ifconfig tun0 | grep 'inet ' | awk '{print \"vpn \" $2}'"

Which is supposed to print my external IP, en0 and, if connected, my vpn connection. extip is my own tool that I wrote myself, but haven't touched in quite some time, and it works great from the command line (and I can see that it gets invoked and returns correctly when attaching a debugger to it). It all worked great until a couple of weeks ago, and since then it just displays <'extip | awk '{print "ip " $1}'' not ready> instead of my external IP address. The rest is still working perfectly without any issues. At first I thought it was just iTerm nightly being unstable, but a couple of updates have passed and it still doesn't work, so I'm feeling that maybe it wasn't supposed at all ever and just did by some kind of fluke? Can anyone give me some pointers with regards to why it may have stopped working and how I can get it to work again?

  • I don't use any of that software, but my first guess would be that iTerm can't find extip in its PATH. – Jeff Schaller Jan 5 '16 at 2:19
  • @JeffSchaller it executes fine in iTerm2 – JustSid Jan 5 '16 at 9:43
  • The few examples I've googled had absolute paths to the scripts. Does anything change if you do that? – Jeff Schaller Jan 5 '16 at 10:40
  • @JeffSchaller Doesn't change a thing, message is the same. – JustSid Jan 5 '16 at 14:05
  • ever figure this out @JustSid I'm seeing the same thing on ubuntu. – thatmiddleway Feb 6 '17 at 4:24
2

https://github.com/tmux/tmux/issues/733#issuecomment-277230881 mentions that

the not ready message is normal, tmux is telling you the command has not finished running yet, it will display the output as soon as the command finishes

I've been seeing this after upgrading from Ubuntu 16.04 to 16.10 with my script that shows the ssh server in window-status-format – it flashes by while connecting. In fact, I can reproduce it by just doing

tmux setw -g window-status-current-format '#(echo `tmux display-message -p "#W #{pane_pid}"`)'

and then ssh aslkfdsdkljfslkdsajf, it'll flash by while trying to connect.

I'm guessing extip takes a while to return a result; what happens if you replace it with a shell script that just does echo 1 or sleep 1; echo 1?

(Note also that tmux should cache any commands once they're executed at least once in that window/pane, but if the command itself changes – as in my example above – it won't use the cache. I've submitted a bug report about silencing the "not ready" command in such cases.)

| improve this answer | |
0

I've tricked this in the past, by instantiating tmux with a rudimentary display-message command (e.g. "Welcome, $USER..."), which seems to gives it a second or so to run the external app for the first time.

Depends on your needs, of course. I start tmux in my profile script but, if you run tmux on demand, you may get away with an alias...

# /usr/bin/tmux -V
tumx 2.4
# /usr/bin/tmux new-session \; display-message "Welcome, $USER..."
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.