Skip to content

Commit

Permalink
[fzf-tmux] Fix cleanup of temporary files
Browse files Browse the repository at this point in the history
  • Loading branch information
junegunn committed Jun 4, 2017
1 parent bf0cb4b commit 3cf9ae0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions bin/fzf-tmux
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ fifo1="${TMPDIR:-/tmp}/fzf-fifo1-$id"
fifo2="${TMPDIR:-/tmp}/fzf-fifo2-$id"
fifo3="${TMPDIR:-/tmp}/fzf-fifo3-$id"
cleanup() {
rm -f $argsf $fifo1 $fifo2 $fifo3
\rm -f $argsf $fifo1 $fifo2 $fifo3

# Remove temp window if we were zoomed
if [[ -n "$zoomed" ]]; then
Expand All @@ -150,6 +150,7 @@ cleanup() {
fi
}
trap 'cleanup 1' SIGUSR1
trap 'cleanup' EXIT

envs="env TERM=$TERM "
[[ -n "$FZF_DEFAULT_OPTS" ]] && envs="$envs FZF_DEFAULT_OPTS=$(printf %q "$FZF_DEFAULT_OPTS")"
Expand All @@ -169,7 +170,7 @@ for arg in "${args[@]}"; do
done

pppid=$$
trap_set="trap 'kill -SIGUSR1 $pppid' EXIT SIGINT SIGTERM"
trap_set="trap 'kill -SIGUSR1 -$pppid' EXIT SIGINT SIGTERM"
trap_unset="trap - EXIT SIGINT SIGTERM"

if [[ -n "$term" ]] || [[ -t 0 ]]; then
Expand Down

0 comments on commit 3cf9ae0

Please sign in to comment.