mirror of
1
0
Fork 0

Merge branch 'gh-208', fixes #208

This commit is contained in:
Gregory Pakosz 2021-11-17 13:00:03 +01:00
commit 618fd66b6f
1 changed files with 21 additions and 6 deletions

View File

@ -501,8 +501,8 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# case "$_uname_s" in # case "$_uname_s" in
# *CYGWIN*) # *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" '
# ((/ssh/ && !/-W/) || !/ssh/) && $5 == tty { # ((/ssh/ && !/-W/) || !/ssh/) && !/tee/ && $5 == tty {
# user[$1] = $6; parent[$1] = $2; child[$2] = $1 # user[$1] = $6; if (!child[$2]) child[$2] = $1
# } # }
# END { # END {
# pid = pane_pid # pid = pane_pid
@ -516,10 +516,24 @@ 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" '
# ((/ssh/ && !/-W/) || !/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])
# pid = child[pid]
#
# print pid":"user[pid]":"command[pid]
# }
# '
# ;;
# *) # *)
# ps -t "$pane_tty" -o user=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -o pid= -o ppid= -o command= | awk -v pane_pid="$pane_pid" ' # ps -t "$pane_tty" -o user=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -o pid= -o ppid= -o command= | awk -v pane_pid="$pane_pid" '
# NR > 1 && ((/ssh/ && !/-W/) || !/ssh/) { # ((/ssh/ && !/-W/) || !/ssh/) && !/tee/ {
# user[$2] = $1; parent[$2] = $3; child[$3] = $2; pid=$2; $1 = $2 = $3 = ""; command[pid] = substr($0,4) # user[$2] = $1; if (!child[$3]) child[$3] = $2; pid=$2; $1 = $2 = $3 = ""; command[pid] = substr($0,4)
# } # }
# END { # END {
# pid = pane_pid # pid = pane_pid
@ -536,7 +550,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# _ssh_or_mosh_args() { # _ssh_or_mosh_args() {
# case "$1" in # case "$1" in
# *ssh*) # *ssh*)
# args=$(printf '%s' "$1" | perl -n -e 'print if s/(.*?)\bssh\b\s+(.*)/\2/') # args=$(printf '%s' "$1" | perl -n -e 'print if s/.*?\bssh[\w]*\s*((?:\s+-\w+)*)(\s+\w+)(\s\w+)?/\1\2/')
# ;; # ;;
# *mosh-client*) # *mosh-client*)
# args=$(printf '%s' "$1" | sed -E -e 's/.*mosh-client -# (.*)\|.*$/\1/' -e 's/-[^ ]*//g' -e 's/\d:\d//g') # args=$(printf '%s' "$1" | sed -E -e 's/.*mosh-client -# (.*)\|.*$/\1/' -e 's/-[^ ]*//g' -e 's/\d:\d//g')
@ -560,7 +574,8 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# # shellcheck disable=SC2086 # # shellcheck disable=SC2086
# username=$(ssh -G $ssh_or_mosh_args 2>/dev/null | awk '/^user / { print $2; exit }') # username=$(ssh -G $ssh_or_mosh_args 2>/dev/null | awk '/^user / { print $2; exit }')
# # shellcheck disable=SC2086 # # shellcheck disable=SC2086
# [ -z "$username" ] && username=$(ssh -T -o ControlPath=none -o ProxyCommand="sh -c 'echo %%username%% %r >&2'" $ssh_or_mosh_args 2>&1 | awk '/^%username% / { print $2; exit }') # [ -z "$username" ] && username=$(ssh $ssh_or_mosh_args -T -o ControlPath=none -o ProxyCommand="sh -c 'echo %%username%% %r >&2'" 2>&1 | awk '/^%username% / { print $2; exit }')
# [ -z "$username" ] && username=$(ssh $ssh_or_mosh_args -v -T -o ControlPath=none -o ProxyCommand=false -o IdentityFile='%%username%%/%r' 2>&1 | awk '/%username%/ { print substr($4,12); exit }')
# else # else
# if ! _is_enabled "$ssh_only"; then # if ! _is_enabled "$ssh_only"; then
# username=${pane_info#*:} # username=${pane_info#*:}