1
0
Fork 0
mirror of synced 2024-12-21 22:31:06 -05:00

worked around Falcon.app agent slowing everything down, fixes #492

it appears the Falcon anti-malware product for end-points slows down ps -t /dev/ttysXXX
commands 🤷

the workaround consists in passing ttysXXX instead of /dev/ttysXXX and is achieved
by removing the /dev/ prefix in #{pane_tty} expansion with the help of formats
substitutions
This commit is contained in:
Gregory Pakosz 2021-10-03 09:43:18 +02:00
parent df46ab2ba9
commit f8a5a08868

View file

@ -558,7 +558,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# }
#
# _username() {
# tty=${1:-$(tmux display -p '#{pane_tty}')}
# tty=${1:-$(tmux display -p '#{s,/dev/,,:pane_tty}')}
# ssh_only=$2
#
# tty_info=$(_tty_info "$tty")
@ -582,7 +582,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# }
#
# _hostname() {
# tty=${1:-$(tmux display -p '#{pane_tty}')}
# tty=${1:-$(tmux display -p '#{s,/dev/,,:pane_tty}')}
# ssh_only=$2
# full=$3
# h_or_H=$4
@ -618,7 +618,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# }
#
# _root() {
# tty=${1:-$(tmux display -p '#{pane_tty}')}
# tty=${1:-$(tmux display -p '#{s,/dev/,,:pane_tty}')}
# root=$2
#
# username=$(_username "$tty" false)
@ -675,7 +675,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# }
#
# _split_window_ssh() {
# tty=${1:-$(tmux display -p '#{pane_tty}')}
# tty=${1:-$(tmux display -p '#{s,/dev/,,:pane_tty}')}
# shift
#
# tty_info=$(_tty_info "$tty")
@ -726,7 +726,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# perl -p -i -e "
# s/\bnew-window\b([^;}\n]*?)(?:\s+-c\s+((?:\\\\\")?|\"?|'?)#\{pane_current_path\}\2)/new-window\1/g
# ;
# s/\brun-shell\b\s+(\"|')cut\s+-c3-\s+~\/\.tmux\.conf\s+\|\s+sh\s+-s\s+_split_window\s+#\{pane_tty\}([^\n\1]*)(\s+-c\s+((?:\\\\\")?|\"?|'?)#\{pane_current_path\}\4)([^\n\1]*)\1/run-shell \1cut -c3- ~\/.tmux.conf | sh -s _split_window #{pane_tty}\2\5\1/g
# s/\brun-shell\b\s+(\"|')cut\s+-c3-\s+~\/\.tmux\.conf\s+\|\s+sh\s+-s\s+_split_window\s+#\{pane_tty\}([^\n\1]*)(\s+-c\s+((?:\\\\\")?|\"?|'?)#\{pane_current_path\}\4)([^\n\1]*)\1/run-shell \1cut -c3- ~\/.tmux.conf | sh -s _split_window #{s,/dev/,,:pane_tty}\2\5\1/g
# ;
# s/\brun-shell\b(\s+((?:\\\\\")?|\"?|'?)cut\s+-c3-\s+~\/\.tmux\.conf\s+\|\s+sh\s+-s\s+_split_window\s+((?:\\\\\")?|\"?|'?)#\{pane_tty\}\3)(.*?)\2/split-window\4/g
# ;
@ -893,12 +893,12 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# tmux_conf_theme_terminal_title=$(echo "$tmux_conf_theme_terminal_title" | sed \
# -e 's%#{circled_window_index}%#(cut -c3- ~/.tmux.conf | sh -s _circled #I)%g' \
# -e 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled #S)%g' \
# -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} false #D)%g' \
# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false false #h #D)%g' \
# -e 's%#{hostname_full}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false true #H #D)%g' \
# -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} true #D)%g' \
# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true false #h #D)%g' \
# -e 's%#{hostname_full_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true true #H #D)%g')
# -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{s,/dev/,,:pane_tty} false #D)%g' \
# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{s,/dev/,,:pane_tty} false false #h #D)%g' \
# -e 's%#{hostname_full}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{s,/dev/,,:pane_tty} false true #H #D)%g' \
# -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{s,/dev/,,:pane_tty} true #D)%g' \
# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{s,/dev/,,:pane_tty} true false #h #D)%g' \
# -e 's%#{hostname_full_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{s,/dev/,,:pane_tty} true true #H #D)%g')
#
# tmux_conf_theme_window_status_fg=${tmux_conf_theme_window_status_fg:-$tmux_conf_theme_colour_3}
# tmux_conf_theme_window_status_bg=${tmux_conf_theme_window_status_bg:-$tmux_conf_theme_colour_1}
@ -974,21 +974,21 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# tmux_conf_theme_window_status_format=$(echo "$tmux_conf_theme_window_status_format" | sed \
# -e 's%#{circled_window_index}%#(cut -c3- ~/.tmux.conf | sh -s _circled #I)%g' \
# -e 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled #S)%g' \
# -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} false #D)%g' \
# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false false #h #D)%g' \
# -e 's%#{hostname_full}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false true #H #D)%g' \
# -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} true #D)%g' \
# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true false #h #D)%g' \
# -e 's%#{hostname_full_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true true #H #D)%g')
# -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{s,/dev/,,:pane_tty} false #D)%g' \
# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{s,/dev/,,:pane_tty} false false #h #D)%g' \
# -e 's%#{hostname_full}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{s,/dev/,,:pane_tty} false true #H #D)%g' \
# -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{s,/dev/,,:pane_tty} true #D)%g' \
# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{s,/dev/,,:pane_tty} true false #h #D)%g' \
# -e 's%#{hostname_full_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{s,/dev/,,:pane_tty} true true #H #D)%g')
# tmux_conf_theme_window_status_current_format=$(echo "$tmux_conf_theme_window_status_current_format" | sed \
# -e 's%#{circled_window_index}%#(cut -c3- ~/.tmux.conf | sh -s _circled #I)%g' \
# -e 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled #S)%g' \
# -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} false #D)%g' \
# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false false #h #D)%g' \
# -e 's%#{hostname_full}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false true #H #D)%g' \
# -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} true #D)%g' \
# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true false #h #D)%g' \
# -e 's%#{hostname_full_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true true #H #D)%g')
# -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{s,/dev/,,:pane_tty} false #D)%g' \
# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{s,/dev/,,:pane_tty} false false #h #D)%g' \
# -e 's%#{hostname_full}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{s,/dev/,,:pane_tty} false true #H #D)%g' \
# -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{s,/dev/,,:pane_tty} true #D)%g' \
# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{s,/dev/,,:pane_tty} true false #h #D)%g' \
# -e 's%#{hostname_full_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{s,/dev/,,:pane_tty} true true #H #D)%g')
#
# # -- indicators
#
@ -1034,10 +1034,10 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
#
# if [ -n "$(tmux display -p '#{version}')" ]; then
# status_left=$(echo "$status_left" | sed \
# -e "s%#{root}%#[fg=$tmux_conf_theme_root_fg]#[bg=$tmux_conf_theme_root_bg]#[$tmux_conf_theme_root_attr]#{?#{==:#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} #D),root},$tmux_conf_theme_root,}#[inherit]%g")
# -e "s%#{root}%#[fg=$tmux_conf_theme_root_fg]#[bg=$tmux_conf_theme_root_bg]#[$tmux_conf_theme_root_attr]#{?#{==:#(cut -c3- ~/.tmux.conf | sh -s _username #{s,/dev/,,:pane_tty} #D),root},$tmux_conf_theme_root,}#[inherit]%g")
# else
# status_left=$(echo "$status_left" | sed \
# -e "s%#{root}%#[fg=$tmux_conf_theme_root_fg]#[bg=$tmux_conf_theme_root_bg]#[$tmux_conf_theme_root_attr]#(cut -c3- ~/.tmux.conf | sh -s _root #{pane_tty} $tmux_conf_theme_root #D)#[inherit]%g")
# -e "s%#{root}%#[fg=$tmux_conf_theme_root_fg]#[bg=$tmux_conf_theme_root_bg]#[$tmux_conf_theme_root_attr]#(cut -c3- ~/.tmux.conf | sh -s _root #{s,/dev/,,:pane_tty} $tmux_conf_theme_root #D)#[inherit]%g")
# fi
#
# status_left=$(printf '%s' "$status_left" | awk \
@ -1122,10 +1122,10 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
#
# if [ -n "$(tmux display -p '#{version}')" ]; then
# status_right=$(echo "$status_right" | sed \
# -e "s%#{root}%#[fg=$tmux_conf_theme_root_fg]#[bg=$tmux_conf_theme_root_bg]#[$tmux_conf_theme_root_attr]#{?#{==:#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} #D),root},$tmux_conf_theme_root,}#[inherit]%g")
# -e "s%#{root}%#[fg=$tmux_conf_theme_root_fg]#[bg=$tmux_conf_theme_root_bg]#[$tmux_conf_theme_root_attr]#{?#{==:#(cut -c3- ~/.tmux.conf | sh -s _username #{s,/dev/,,:pane_tty} #D),root},$tmux_conf_theme_root,}#[inherit]%g")
# else
# status_right=$(echo "$status_right" | sed \
# -e "s%#{root}%#[fg=$tmux_conf_theme_root_fg]#[bg=$tmux_conf_theme_root_bg]#[$tmux_conf_theme_root_attr]#(cut -c3- ~/.tmux.conf | sh -s _root #{pane_tty} $tmux_conf_theme_root #D)#[inherit]%g")
# -e "s%#{root}%#[fg=$tmux_conf_theme_root_fg]#[bg=$tmux_conf_theme_root_bg]#[$tmux_conf_theme_root_attr]#(cut -c3- ~/.tmux.conf | sh -s _root #{s,/dev/,,:pane_tty} $tmux_conf_theme_root #D)#[inherit]%g")
# fi
#
# status_right=$(printf '%s' "$status_right" | awk \
@ -1229,19 +1229,19 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# case "$status_left $status_right" in
# *'#{username}'*|*'#{hostname}'*|*'#{hostname_full}'*|*'#{username_ssh}'*|*'#{hostname_ssh}'*|*'#{hostname_full_ssh}'*)
# status_left=$(echo "$status_left" | sed \
# -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} false #D)%g' \
# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false false #h #D)%g' \
# -e 's%#{hostname_full}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false true #H #D)%g' \
# -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} true #D)%g' \
# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true false #h #D)%g' \
# -e 's%#{hostname_full_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true true #H #D)%g')
# -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{s,/dev/,,:pane_tty} false #D)%g' \
# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{s,/dev/,,:pane_tty} false false #h #D)%g' \
# -e 's%#{hostname_full}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{s,/dev/,,:pane_tty} false true #H #D)%g' \
# -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{s,/dev/,,:pane_tty} true #D)%g' \
# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{s,/dev/,,:pane_tty} true false #h #D)%g' \
# -e 's%#{hostname_full_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{s,/dev/,,:pane_tty} true true #H #D)%g')
# status_right=$(echo "$status_right" | sed \
# -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} false #D)%g' \
# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false false #h #D)%g' \
# -e 's%#{hostname_full}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false true #H #D)%g' \
# -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} true #D)%g' \
# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true false #h #D)%g' \
# -e 's%#{hostname_full_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true true #H #D)%g')
# -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{s,/dev/,,:pane_tty} false #D)%g' \
# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{s,/dev/,,:pane_tty} false false #h #D)%g' \
# -e 's%#{hostname_full}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{s,/dev/,,:pane_tty} false true #H #D)%g' \
# -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{s,/dev/,,:pane_tty} true #D)%g' \
# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{s,/dev/,,:pane_tty} true false #h #D)%g' \
# -e 's%#{hostname_full_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{s,/dev/,,:pane_tty} true true #H #D)%g')
# ;;
# esac
#