Skip to content
Myr

[fzf-tmux] Execute trap with bash instead of the default shell

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Close #1007

authored by Junegunn Choi · committed by Junegunn Choi · parent e825b07 · Browse files · 1 file+8 added−6 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+8 added−6 removed

  • other:+8 added−6 removed

1 file+8 added−6 removed

modified:bin/fzf-tmux+8 added-6 removed
144 unmodified lines
145 resize-pane -Z146 fi147148 if [ $# -gt 0 ]; then149 trap - EXIT150 exit 130151 fi152}153trap 'cleanup 1' SIGUSR1
16 unmodified lines
170 opts="$opts \"$arg\""171done172173pppid=$$173trap_set="trap 'kill -SIGUSR1 -$pppid' EXIT SIGINT SIGTERM"174trap_unset="trap - EXIT SIGINT SIGTERM"174echo -n "trap 'kill -SIGUSR1 -$pppid' EXIT SIGINT SIGTERM;" > $argsf175close="; trap - EXIT SIGINT SIGTERM $close"176177if [[ -n "$term" ]] || [[ -t 0 ]]; then177 cat <<< "\"$fzf\" $opts > $fifo2; echo \$? > $fifo3 $close" > $argsf178 cat <<< "\"$fzf\" $opts > $fifo2; echo \$? > $fifo3 $close" >> $argsf179 cat $argsf180 TMUX=$(echo $TMUX | cut -d , -f 1,2) tmux set-window-option synchronize-panes off \;\181 set-window-option remain-on-exit off \;\180 split-window $opt "$trap_set;cd $(printf %q "$PWD");$envs bash $argsf;$trap_unset" $swap \182 split-window $opt "cd $(printf %q "$PWD");$envs bash $argsf" $swap \183 > /dev/null 2>&1184else185 mkfifo $fifo1184 cat <<< "\"$fzf\" $opts < $fifo1 > $fifo2; echo \$? > $fifo3 $close" > $argsf186 cat <<< "\"$fzf\" $opts < $fifo1 > $fifo2; echo \$? > $fifo3 $close" >> $argsf187 TMUX=$(echo $TMUX | cut -d , -f 1,2) tmux set-window-option synchronize-panes off \;\188 set-window-option remain-on-exit off \;\187 split-window $opt "$trap_set;$envs bash $argsf;$trap_unset" $swap \189 split-window $opt "$envs bash $argsf" $swap \190 > /dev/null 2>&1191 cat <&0 > $fifo1 &192fi193cat $fifo2
2 unmodified lines