Closed nraiha closed 1 week ago
Would the --sync
flag solve your issue ?
--sync Synchronous search for multi-staged filtering. If specified, fzf will launch the
finder only after the input stream is complete.
sudo echo hi | fzf --sync
Alternatively:
sudo echo hi > /tmp/list
fzf < /tmp/list
Ref: https://github.com/junegunn/fzf/issues/2412#issuecomment-809157288
Checklist
man fzf
)Output of
fzf --version
0.53.0 (c4a9ccd)
OS
Shell
Problem / Steps to reproduce
When fzf is piped to a command requiring sudo, fzf does not wait for sudo prompt to be entered. You can briefly see sudo prompting for the password before an empty fzf window appears.
Additionally, when the fzf window is closed, stdin echo is toggled. If the sudo prompt is canceled, the stdin echo will be toggled again.
sudo echo hi | ./fzf
-> terminate with Ctrl-C[sudo] password for nraiha: hunter2
<- the password entry can be now seen. Stdin will now be seen normally.If sudo prompt is terminated with Ctrl-C, stdin echo will not be toggled.
For example, if I run commands in following order (CTRL-C to fzf and sudo prompt):
Terminal will look like: