summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2017-06-04 23:24:57 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2017-06-04 23:24:57 +0900
commit3cf9ae04c7d8ed13906baea2d12258e44a94b306 (patch)
treebb2e84e5586751405575983f7577a9570ac9ac3e /bin
parentbf0cb4bfe208cecb99ac27e6770c6d034d1bff3c (diff)
[fzf-tmux] Fix cleanup of temporary files
Close #935
Diffstat (limited to 'bin')
-rwxr-xr-xbin/fzf-tmux5
1 files changed, 3 insertions, 2 deletions
diff --git a/bin/fzf-tmux b/bin/fzf-tmux
index b01d995d..5ec0dc4f 100755
--- a/bin/fzf-tmux
+++ b/bin/fzf-tmux
@@ -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
@@ -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")"
@@ -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