From bd171fabc3934273856364bf85ec72b92c0d4094 Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Mon, 7 Oct 2024 16:51:32 +0200 Subject: [PATCH] worked around termux's readlink returning /apex/com.android.runtime/bin/linker64 when reading /proc//exe, resolves #765 see also termux-play-store/termux-issues#149 --- .tmux.conf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.tmux.conf b/.tmux.conf index cbeba73..1c996ca 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -144,8 +144,7 @@ bind P choose-buffer # choose which buffer to paste from # -- 8< ------------------------------------------------------------------------ %if #{==:#{TMUX_PROGRAM},} - run "exec sh -c '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"' + run "exec sh -c '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; {\" 2>/dev/null || readlink \"/proc/#{pid}/exe\" 2>/dev/null)\"; [ x\"\$(\"\$TMUX_PROGRAM\" display -p \"#{l:#{pid}}\" 2>/dev/null)\" = x\"#{pid}\" ] || TMUX_PROGRAM=\"\$(command -v tmux || printf tmux)\"; \"\$TMUX_PROGRAM\" -S #{socket_path} set-environment -g TMUX_PROGRAM \"\$TMUX_PROGRAM\"'" %endif %if #{==:#{TMUX_SOCKET},} run "exec sh -c '\"\$TMUX_PROGRAM\" -S #{socket_path} set-environment -g TMUX_SOCKET \"#{socket_path}\"'" @@ -157,7 +156,7 @@ bind P choose-buffer # choose which buffer to paste from run "exec sh -c '\"\$TMUX_PROGRAM\" set-environment -g TMUX_CONF_LOCAL \"\$TMUX_CONF.local\"'" %endif -run '"$TMUX_PROGRAM" source "$TMUX_CONF_LOCAL"' +run '"$TMUX_PROGRAM" -S #{socket_path} source "$TMUX_CONF_LOCAL"' run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration' # EOF @@ -189,7 +188,8 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration' # fi # if [ -z "$TMUX_PROGRAM" ]; then # TMUX_PID=$(printf '%s' "$TMUX" | cut -d, -f2) -# TMUX_PROGRAM=$(lsof -b -w -a -d txt -p "$TMUX_PID" -Fn 2>/dev/null | perl -n -e "if (s/^n((?:.(?!dylib$|so$))+)$/\1/g) { print; exit } } exit 1; {" || readlink "/proc/$TMUX_PID/exe" 2>/dev/null || printf tmux) +# TMUX_PROGRAM=$(lsof -b -w -a -d txt -p "$TMUX_PID" -Fn 2>/dev/null | perl -n -e "if (s/^n((?:.(?!dylib$|so$))+)$/\1/g) { print; exit } } exit 1; {" 2>/dev/null || readlink "/proc/$TMUX_PID/exe" 2>/dev/null) +# [ x"$("$TMUX_PROGRAM" -S "$TMUX_SOCKET" display -p '#{pid}' 2>/dev/null)" = x"$TMUX_PID" ] || TMUX_PROGRAM=$(command -v tmux || printf tmux) # fi # if [ "$TMUX_PROGRAM" = "tmux" ]; then # tmux() {