Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

zsh

tmux

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.

like image 772
kenny Avatar asked Dec 20 '22 23:12

kenny


1 Answers

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.

like image 167
Chris Johnsen Avatar answered Dec 28 '22 13:12

Chris Johnsen