summaryrefslogtreecommitdiff
path: root/src/proxy.go
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2024-05-23 20:08:20 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2024-05-23 21:11:12 +0900
commit3dee8778d073199e0fe1e186e54f7eabc2fdef43 (patch)
tree1c39e76cf456b176cee9c4763ddbd8447e4ce406 /src/proxy.go
parentd4216b0dcc13567479d81cc5ad2adedb1443ea8b (diff)
downloadfzf-3dee8778d073199e0fe1e186e54f7eabc2fdef43.tar.gz
execute: Open separate handles to /dev/tty (in, out, err)
# This will no longer cause 'Vim: Warning: Output is not to a terminal' fzf --bind 'enter:execute:vim {}' > /tmp/foo
Diffstat (limited to 'src/proxy.go')
-rw-r--r--src/proxy.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/proxy.go b/src/proxy.go
index adeea213..5ee7317c 100644
--- a/src/proxy.go
+++ b/src/proxy.go
@@ -60,7 +60,7 @@ func runProxy(commandPrefix string, cmdBuilder func(temp string) *exec.Cmd, opts
var command string
commandPrefix += ` --proxy-script "$0"`
- if opts.Input == nil && util.IsTty() {
+ if opts.Input == nil && util.IsTty(os.Stdin) {
command = fmt.Sprintf(`%s > %q`, commandPrefix, output)
} else {
input, err := fifo("proxy-input")
@@ -131,7 +131,11 @@ func runProxy(commandPrefix string, cmdBuilder func(temp string) *exec.Cmd, opts
env = elems[1:]
}
executor := util.NewExecutor(opts.WithShell)
- executor.Become(tui.TtyIn(), env, command)
+ ttyin, err := tui.TtyIn()
+ if err != nil {
+ return ExitError, err
+ }
+ executor.Become(ttyin, env, command)
}
return code, err
}