In MacOS, I have a shell script that makes some changes to my tmux config file, then reloads it (by running tmux source-file
). Usually, it completes successfully, but sometimes (I estimate about 5%) it “hangs”–when I run it from the terminal, the configuration reloads as expected, but I never get dropped back to the prompt. After experimenting, I’ve narrowed the problem down to the tmux source-file
line, so I can reproduce it with this minimal script:
#!/bin/zsh
DEBUG_LOG='/Users/cfink/Desktop/test.log'
CONF_FILE='/Users/cfink/.tmux.conf'
printf "reloading config filen" >> $DEBUG_LOG
/usr/local/bin/tmux source-file $CONF_FILE
printf "done!n" >> $DEBUG_LOG
If I check test.log after it hangs, the last line is reloading config file
. I’m not doing anything different in those instances. Is there some reason tmux source-file
might fail when run via a shell script? Is there anything else I can do to diagnose the problem?