Hello, I'm porting an old program I use from LiveScript (js) to nim and having 
trouble with calling fzf in a subprocess. What I would like to do is:

  1. execute fzf
  2. give the output of a nim proc to fzf's stdin
  3. use fzf interactively to select a line
  4. read the stdout from fzf



I have tried using many combinations of things in `osproc` to do this but have 
not been able to get it working. I see someone had the same problem two years 
ago but they don't seem to have figured it out.

<https://forum.nim-lang.org/t/4146>

There's a kind of solution on StackOverflow, but it's a pretty messy workaround 
involving a named pipe.

<https://stackoverflow.com/questions/51932881/calling-fzf-from-nim-doesnt-show-fzfs-tui>

I also saw this PR, which may be kind of related; it seems complete but has 
just kind of been sitting there for a while.

<https://github.com/nim-lang/Nim/issues/7999>

It seems like the natural thing is to use startProcess with poParentStreams and 
then use the input/output streams of the child process, but access to the 
input/output streams of the child isn't allowed with poParentStreams. I checked 
the nim source but there was no explanation for why this was the case.

Has anyone had any success with fzf or other interactive tty programs and nim? 
I'm not really sure what to do about this... I've managed to call vim without 
issue using execCmd, but there doesn't seem to be any way to pipe input to a 
process called that way.

Reply via email to