fixed #{username} being truncated under Cygwin
This commit is contained in:
parent
74602e8d8d
commit
7a64679c2d
1 changed files with 54 additions and 51 deletions
41
.tmux.conf
41
.tmux.conf
|
@ -501,14 +501,9 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim
|
|||
# tty="${1##/dev/}"
|
||||
# case "$_uname_s" in
|
||||
# *CYGWIN*)
|
||||
# cygwin=true
|
||||
# ;;
|
||||
# esac
|
||||
#
|
||||
# if [ x"$cygwin" = x"true" ]; then
|
||||
# ps -af | tail -n +2 | awk -v tty="$tty" '
|
||||
# ((/ssh/ && !/-W/) || !/ssh/) && $4 == tty {
|
||||
# user[$2] = $1; parent[$2] = $3; child[$3] = $2
|
||||
# ps -al | tail -n +2 | awk -v tty="$tty" '
|
||||
# ((/ssh/ && !/-W/) || !/ssh/) && $5 == tty {
|
||||
# user[$1] = $6; parent[$1] = $2; child[$2] = $1
|
||||
# }
|
||||
# END {
|
||||
# for (i in parent)
|
||||
|
@ -521,16 +516,18 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim
|
|||
# {
|
||||
# file = "/proc/" i "/cmdline"; getline command < file; close(file)
|
||||
# gsub(/\0/, " ", command)
|
||||
# print i, user[i], command
|
||||
# "id -un " user[i] | getline username
|
||||
# print i":"username":"command
|
||||
# exit
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
# '
|
||||
# else
|
||||
# ;;
|
||||
# *)
|
||||
# ps -t "$tty" -o user=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -o pid= -o ppid= -o command= | awk '
|
||||
# NR > 1 && ((/ssh/ && !/-W/) || !/ssh/) {
|
||||
# user[$2] = $1; parent[$2] = $3; child[$3] = $2; pid=$2; $1 = $2 = $3 = ""; command[pid] = $0
|
||||
# user[$2] = $1; parent[$2] = $3; child[$3] = $2; pid=$2; $1 = $2 = $3 = ""; command[pid] = substr($0,4)
|
||||
# }
|
||||
# END {
|
||||
# for (i in parent)
|
||||
|
@ -541,19 +538,20 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim
|
|||
#
|
||||
# if (!(i in child) && j != 1)
|
||||
# {
|
||||
# print i, user[i], command[i]
|
||||
# print i":"user[i]":"command[i]
|
||||
# exit
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
# '
|
||||
# fi
|
||||
# ;;
|
||||
# esac
|
||||
# }
|
||||
#
|
||||
# _ssh_or_mosh_args() {
|
||||
# case "$1" in
|
||||
# *ssh*)
|
||||
# args=$(printf '%s' "$1" | awk '/ssh/ && !/vagrant ssh/ && !/autossh/ && !/-W/ { $1 = $2 = $3 = ""; print $0; exit }')
|
||||
# args=$(printf '%s' "$1" | awk '/ssh/ && !/vagrant ssh/ && !/autossh/ && !/-W/ { $1 = ""; print $0; exit }')
|
||||
# ;;
|
||||
# *mosh-client*)
|
||||
# args=$(printf '%s' "$1" | sed -E -e 's/.*mosh-client -# (.*)\|.*$/\1/' -e 's/-[^ ]*//g' -e 's/\d:\d//g')
|
||||
|
@ -568,8 +566,10 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim
|
|||
# ssh_only=$2
|
||||
#
|
||||
# tty_info=$(_tty_info "$tty")
|
||||
# command=${tty_info#*:}
|
||||
# command=${command#*:}
|
||||
#
|
||||
# ssh_or_mosh_args=$(_ssh_or_mosh_args "$tty_info")
|
||||
# ssh_or_mosh_args=$(_ssh_or_mosh_args "$command")
|
||||
# if [ -n "$ssh_or_mosh_args" ]; then
|
||||
# # shellcheck disable=SC2086
|
||||
# username=$(ssh -G $ssh_or_mosh_args 2>/dev/null | awk '/^user / { print $2; exit }')
|
||||
|
@ -577,8 +577,8 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim
|
|||
# [ -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 }')
|
||||
# else
|
||||
# if ! _is_enabled "$ssh_only"; then
|
||||
# username="${tty_info#* }"
|
||||
# username="${username%% *}"
|
||||
# username=${tty_info#*:}
|
||||
# username=${username%%:*}
|
||||
# fi
|
||||
# fi
|
||||
#
|
||||
|
@ -590,8 +590,10 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim
|
|||
# ssh_only=$2
|
||||
#
|
||||
# tty_info=$(_tty_info "$tty")
|
||||
# command=${tty_info#*:}
|
||||
# command=${command#*:}
|
||||
#
|
||||
# ssh_or_mosh_args=$(_ssh_or_mosh_args "$tty_info")
|
||||
# ssh_or_mosh_args=$(_ssh_or_mosh_args "$command")
|
||||
# if [ -n "$ssh_or_mosh_args" ]; then
|
||||
# # shellcheck disable=SC2086
|
||||
# hostname=$(ssh -G $ssh_or_mosh_args 2>/dev/null | awk '/^hostname / { print $2; exit }')
|
||||
|
@ -677,7 +679,8 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim
|
|||
# shift
|
||||
#
|
||||
# tty_info=$(_tty_info "$tty")
|
||||
# command=$(printf '%s' "$tty_info" | cut -d' ' -f3-)
|
||||
# command=${tty_info#*:}
|
||||
# command=${command#*:}
|
||||
#
|
||||
# case "$command" in
|
||||
# *mosh-client*)
|
||||
|
|
Loading…
Reference in a new issue