added safety nets to TMUX_PROGRAM introspection in case readlink or lsof return broken values (2)
This commit is contained in:
parent
9cf49731cd
commit
49e1bdfa93
1 changed files with 1 additions and 1 deletions
|
@ -139,7 +139,7 @@ bind P choose-buffer # choose which buffer to paste from
|
||||||
# -- 8< ------------------------------------------------------------------------
|
# -- 8< ------------------------------------------------------------------------
|
||||||
|
|
||||||
%if #{==:#{TMUX_PROGRAM},}
|
%if #{==:#{TMUX_PROGRAM},}
|
||||||
run 'TMUX_PROGRAM="$(LSOF=$(PATH="$PATH:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" command -v lsof); $LSOF -b -w -a -d txt -p #{pid} -Fn 2>/dev/null | perl -n -e "if (s/^n((?:.(?!dylib$|so$))+)$/\1/g && s/(?:\s+\([^\s]+?\))?$//g) { print; exit } } exit 1; {" || readlink "/proc/#{pid}/exe" 2>/dev/null)"; {[ -f "$TMUX_PROGRAM" ] && [ -x "$TMUX_PROGRAM" ]} || TMUX_PROGRAM="$(command -v tmux || printf tmux)"; "$TMUX_PROGRAM" -S #{socket_path} set-environment -g TMUX_PROGRAM "$TMUX_PROGRAM"'
|
run 'TMUX_PROGRAM="$(LSOF=$(PATH="$PATH:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" command -v lsof); $LSOF -b -w -a -d txt -p #{pid} -Fn 2>/dev/null | perl -n -e "if (s/^n((?:.(?!dylib$|so$))+)$/\1/g && s/(?:\s+\([^\s]+?\))?$//g) { print; exit } } exit 1; {" || readlink "/proc/#{pid}/exe" 2>/dev/null)"; { [ -f "$TMUX_PROGRAM" ] && [ -x "$TMUX_PROGRAM" ]; } || TMUX_PROGRAM="$(command -v tmux || printf tmux)"; "$TMUX_PROGRAM" -S #{socket_path} set-environment -g TMUX_PROGRAM "$TMUX_PROGRAM"'
|
||||||
%endif
|
%endif
|
||||||
%if #{==:#{TMUX_SOCKET},}
|
%if #{==:#{TMUX_SOCKET},}
|
||||||
run '"$TMUX_PROGRAM" -S #{socket_path} set-environment -g TMUX_SOCKET "#{socket_path}"'
|
run '"$TMUX_PROGRAM" -S #{socket_path} set-environment -g TMUX_SOCKET "#{socket_path}"'
|
||||||
|
|
Loading…
Reference in a new issue