From b7248d41155acb830c629e07da08eab8e31d9fca Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Wed, 26 Feb 2025 20:46:14 +0900 Subject: [PATCH] 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}' --- src/proxy.go | 7 +++++-- 1 file 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