Fzf: Can fzf run with pipes as stdin/stdout?

Created on 3 Mar 2020  路  1Comment  路  Source: junegunn/fzf

  • [x] I have read through the manual page (man fzf)
  • [x] I have the latest version of fzf
  • [x] I have searched through the existing issues

Info

  • OS

    • [ ] Linux

    • [ ] Mac OS X

    • [x] Windows

    • [ ] Etc.

  • Shell

    • [ ] bash

    • [ ] zsh

    • [ ] fish

    • [x] Emacs + CMD

Problem / Steps to reproduce

I run fzf in Windows 10, and it works as expected in the cmd box for the call fzf --filter="tmp" which will give a list of findings.

When I try to use it in Emacs, it fails to capture the output. I consulted in the Emacs help maillist, and it suggested that It looks like fzf uses direct screen I/O? If so, this won't work on Windows when stdout is a pipe, which is what happens when Emacs on Windows runs a subprocess. Whether could we make fzf run with pipes as stdin/stdout?

Best Regards,

question

Most helpful comment

I'm not an Emacs user, so I can't really answer the question, but fzf is designed to work with stdin/stdout pipes.

seq 10 | fzf | cowsay

This is possible because fzf reads from /dev/tty instead of stdin, and prints the finder to stderr instead of stdout. So make sure that stderr of the process is not captured by Emacs. On Vim, system('no-such-command') captures stderr as well, so we use built-in terminal to start fzf instead of using system().

>All comments

I'm not an Emacs user, so I can't really answer the question, but fzf is designed to work with stdin/stdout pipes.

seq 10 | fzf | cowsay

This is possible because fzf reads from /dev/tty instead of stdin, and prints the finder to stderr instead of stdout. So make sure that stderr of the process is not captured by Emacs. On Vim, system('no-such-command') captures stderr as well, so we use built-in terminal to start fzf instead of using system().

Was this page helpful?
0 / 5 - 0 ratings

Related issues

erusev picture erusev  路  3Comments

jberglinds picture jberglinds  路  3Comments

skamsie picture skamsie  路  3Comments

jan-warchol picture jan-warchol  路  3Comments

firedev picture firedev  路  3Comments