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.
Thank you, I saw ff but to be honest I have difficulty following how it works with SELECT and I don't dev on Windows...
The first thing I did that worked was write the output to a file. While that got the desired output, it wasn't exactly what I wanted. The proc that gives output to fzf takes a while to finish, but what I want is usually in the first few lines of output. So writing to a file and then starting fzf means I have to wait too long.
What I ended up doing is spawning another instance of the calling process in a shell using execCmd and writing to a file which I read back. This feels silly but it works like I want and fzf is very responsive.