updated _pane_info() to stop walking down the process tree at the first ssh command found, fixes #748
which helps when the ssh configuration uses ProxyCommand to connect to the remote host
This commit is contained in:
parent
5fcc377128
commit
6e22cc2965
1 changed files with 19 additions and 7 deletions
26
.tmux.conf
26
.tmux.conf
|
@ -189,7 +189,7 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
|
|||
# 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; {" 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)
|
||||
# [ "$("$TMUX_PROGRAM" -S "$TMUX_SOCKET" display -p '#{pid}' 2>/dev/null)" = "$TMUX_PID" ] || TMUX_PROGRAM=$(command -v tmux || printf tmux)
|
||||
# fi
|
||||
# if [ "$TMUX_PROGRAM" = "tmux" ]; then
|
||||
# tmux() {
|
||||
|
@ -611,14 +611,18 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
|
|||
# pane_tty="${2##/dev/}"
|
||||
# case "$_uname_s" in
|
||||
# *CYGWIN*)
|
||||
# ps -al | tail -n +2 | awk -v pane_pid="$pane_pid" -v tty="$pane_tty" '
|
||||
# ps -al | tail -n +2 | awk -v pane_pid="$pane_pid" -v tty="$pane_tty" -v ssh="$(command -v ssh)" '
|
||||
# ((/ssh/ && !/-W/ && !/tsh proxy ssh/ &!/sss_ssh_knownhostsproxy/) || !/ssh/) && !/tee/ && $5 == tty {
|
||||
# user[$1] = $6; if (!child[$2]) child[$2] = $1
|
||||
# }
|
||||
# END {
|
||||
# pid = pane_pid
|
||||
# while (child[pid])
|
||||
# while (child[pid]) {
|
||||
# if (match(command[pid], "^" ssh " |^ssh ")) {
|
||||
# break
|
||||
# }
|
||||
# pid = child[pid]
|
||||
# }
|
||||
#
|
||||
# file = "/proc/" pid "/cmdline"; getline command < file; close(file)
|
||||
# gsub(/\0/, " ", command)
|
||||
|
@ -628,28 +632,36 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
|
|||
# '
|
||||
# ;;
|
||||
# *Linux*)
|
||||
# ps -t "$pane_tty" --sort=lstart -o user=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -o pid= -o ppid= -o command= | awk -v pane_pid="$pane_pid" '
|
||||
# ps -t "$pane_tty" --sort=lstart -o user=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -o pid= -o ppid= -o command= | awk -v pane_pid="$pane_pid" -v ssh="$(command -v ssh)" '
|
||||
# ((/ssh/ && !/-W/ && !/tsh proxy ssh/ && !/sss_ssh_knownhostsproxy/) || !/ssh/) && !/tee/ {
|
||||
# user[$2] = $1; if (!child[$3]) child[$3] = $2; pid=$2; $1 = $2 = $3 = ""; command[pid] = substr($0,4)
|
||||
# }
|
||||
# END {
|
||||
# pid = pane_pid
|
||||
# while (child[pid])
|
||||
# while (child[pid]) {
|
||||
# if (match(command[pid], "^" ssh " |^ssh ")) {
|
||||
# break
|
||||
# }
|
||||
# pid = child[pid]
|
||||
# }
|
||||
#
|
||||
# print pid":"user[pid]":"command[pid]
|
||||
# }
|
||||
# '
|
||||
# ;;
|
||||
# *)
|
||||
# ps -t "/dev/$pane_tty" -o user=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -o pid= -o ppid= -o command= | awk -v pane_pid="$pane_pid" '
|
||||
# ps -t "/dev/$pane_tty" -o user=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -o pid= -o ppid= -o command= | awk -v pane_pid="$pane_pid" -v ssh="$(command -v ssh)" '
|
||||
# ((/ssh/ && !/-W/ && !/tsh proxy ssh/ && !/sss_ssh_knownhostsproxy/) || !/ssh/) && !/tee/ {
|
||||
# user[$2] = $1; if (!child[$3]) child[$3] = $2; pid=$2; $1 = $2 = $3 = ""; command[pid] = substr($0,4)
|
||||
# }
|
||||
# END {
|
||||
# pid = pane_pid
|
||||
# while (child[pid])
|
||||
# while (child[pid]) {
|
||||
# if (match(command[pid], "^" ssh " |^ssh ")) {
|
||||
# break
|
||||
# }
|
||||
# pid = child[pid]
|
||||
# }
|
||||
#
|
||||
# print pid":"user[pid]":"command[pid]
|
||||
# }
|
||||
|
|
Loading…
Reference in a new issue