when lsof cannot be found in PATH, search in /usr/local/bin, /usr/bin, /bin, /usr/sbin and /sbin
this helps using tmux as a default shell on macOS where PATH is initially set to /usr/bin:/bin resolves #587
This commit is contained in:
parent
55d47e9c15
commit
7706ab724f
1 changed files with 1 additions and 1 deletions
|
@ -145,7 +145,7 @@ bind P choose-buffer # choose which buffer to paste from
|
||||||
# -- 8< ------------------------------------------------------------------------
|
# -- 8< ------------------------------------------------------------------------
|
||||||
|
|
||||||
%if #{==:#{TMUX_PROGRAM},}
|
%if #{==:#{TMUX_PROGRAM},}
|
||||||
run 'TMUX_PROGRAM="$(lsof -b -w -a -d txt -p #{pid} -Fn 2>/dev/null | perl -n -e "if (s/^n((?:.(?!dylib$|so$))+)$/\1/g) { print; exit } } exit 1; {" || readlink "/proc/#{pid}/exe" 2>/dev/null || 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) { print; exit } } exit 1; {" || readlink "/proc/#{pid}/exe" 2>/dev/null || 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