tmux run command - "returned 126", what does that mean?

Go To StackoverFlow.com

1

In my .tmux.conf I have this line:

bind r run "~/bin/tmux_renum"

But it doesn't work (it's supposed to renumber the tab windows - see http://brainscraps.wikia.com/wiki/Renumbering_tmux_Windows). It pops up the yellow status bar '~/bin/tmux_renum' returned 126.

I can't figure out what this means. Anyone seen this before?

I've been sure to exit out of tmux sessions completely, restarting tmux fresh to test.

If it matters, I'm using zsh too.

2012-04-05 22:16
by kenny
The newly released tmux 1.7 added the move-window -r command and the renumber-windows session option. The former does a one-time renumbering for a single session (current or specified); the latter automatically maintains a “gapless” sequence of window numbers for the session (any session that has done set renumber-windows on, or, with set -g renumber-windows on, for all sessions have not otherwise overridden the option) - Chris Johnsen 2012-10-13 21:58
Great addition to your answer below. Don't forget to upvote - kenny 2012-10-13 23:18


8

The tmux command run-shell (abbreviated to run in your configuration), passes the string to /bin/sh. Unless your script is running and exiting with code 126, then it is probably your /bin/sh that is returning this exit code.

The high-number exit codes (126 and 127) are given by the shell when there is a problem executing the command. Specifically, (per POSIX.1) 126 usually means that the file was not executable.

Try this:

chmod +x ~/bin/tmux_renum

Technically, it uses whatever _PATH_BSHELL is defined as, but this is almost always /bin/sh on Unix-like systems.

2012-04-06 02:27
by Chris Johnsen
Friggin brilliant. And my new toy works now : - kenny 2012-04-06 18:34
Ads