summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2025-02-26 20:46:14 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2025-02-26 20:47:09 +0900
commitb7248d41155acb830c629e07da08eab8e31d9fca (patch)
tree5c3b4e51cd17908eec7d2933cde5a48b0dc56ff8
parent639253840fc553cc6a082b3f1275e72903ecc0eb (diff)
downloadfzf-b7248d41155acb830c629e07da08eab8e31d9fca.tar.gz
Remove temp files before 'become' when using --tmux option
Close #4283 But the temp files for the `f` flags in the 'become' template will not be removed, because we will need them after "becoming" another program. e.g. fzf --bind 'enter:become:cat {f}'
-rw-r--r--src/proxy.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/proxy.go b/src/proxy.go
index caddee48..660b0f94 100644
--- a/src/proxy.go
+++ b/src/proxy.go
@@ -59,12 +59,12 @@ func runProxy(commandPrefix string, cmdBuilder func(temp string, needBash bool)
})
}()
- var command string
+ var command, input string
commandPrefix += ` --no-force-tty-in --proxy-script "$0"`
if opts.Input == nil && (opts.ForceTtyIn || util.IsTty(os.Stdin)) {
command = fmt.Sprintf(`%s > %q`, commandPrefix, output)
} else {
- input, err := fifo("proxy-input")
+ input, err = fifo("proxy-input")
if err != nil {
return ExitError, err
}
@@ -148,6 +148,9 @@ func runProxy(commandPrefix string, cmdBuilder func(temp string, needBash bool)
if err != nil {
return ExitError, err
}
+ os.Remove(temp)
+ os.Remove(input)
+ os.Remove(output)
executor.Become(ttyin, env, command)
}
return code, err