Skip to content
Myr

[fzf-tmux] Fix cleanup of temporary files

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

Close #935

authored by Junegunn Choi · committed by Junegunn Choi · parent bf0cb4b · Browse files · 1 file+3 added−2 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+3 added−2 removed

  • other:+3 added−2 removed

1 file+3 added−2 removed

modified:bin/fzf-tmux+3 added-2 removed
132 unmodified lines
133fifo1="${TMPDIR:-/tmp}/fzf-fifo1-$id"134fifo2="${TMPDIR:-/tmp}/fzf-fifo2-$id"135fifo3="${TMPDIR:-/tmp}/fzf-fifo3-$id"136cleanup() {137 rm -f $argsf $fifo1 $fifo2 $fifo3137 \rm -f $argsf $fifo1 $fifo2 $fifo3138139 # Remove temp window if we were zoomed140 if [[ -n "$zoomed" ]]; then141 tmux display-message -p "#{window_id}" > /dev/null
7 unmodified lines
149 exit 130150 fi151}152trap 'cleanup 1' SIGUSR1153trap 'cleanup' EXIT154155envs="env TERM=$TERM "156[[ -n "$FZF_DEFAULT_OPTS" ]] && envs="$envs FZF_DEFAULT_OPTS=$(printf %q "$FZF_DEFAULT_OPTS")"157[[ -n "$FZF_DEFAULT_COMMAND" ]] && envs="$envs FZF_DEFAULT_COMMAND=$(printf %q "$FZF_DEFAULT_COMMAND")"
11 unmodified lines
169 opts="$opts \"$arg\""170done171172pppid=$$172trap_set="trap 'kill -SIGUSR1 $pppid' EXIT SIGINT SIGTERM"173trap_set="trap 'kill -SIGUSR1 -$pppid' EXIT SIGINT SIGTERM"174trap_unset="trap - EXIT SIGINT SIGTERM"175176if [[ -n "$term" ]] || [[ -t 0 ]]; then177 cat <<< "\"$fzf\" $opts > $fifo2; echo \$? > $fifo3 $close" > $argsf
16 unmodified lines