Hey all,

I'm trying to learn nim by porting some python script of mine to nim. In one of 
it the core part is a call to [fzf](https://github.com/junegunn/fzf) a fuzzy 
chooser like dmenu in the terminal. The python code looks something like the 
following:
    
    
    fzf = subprocess.Popen(["fzf"], stdin=subprocess.PIPE, 
stdout=subprocess.PIPE)
    stdout, stderr = fzf.communicate(some_data)
    
    
    Run

fzf uses a clever "trick" to use still be interactive: It opens /dev/tty for 
interaction with the user. This way fzf works in pipes: find . -name "*.mp3" | 
fzf | xargs vlc.

So I tried to port that code to nim:
    
    
    var p = startProcess(path_to_fzf)
    var stream = p.inputStream()
    stream.write(some_data)
    stream.flush()
    
    
    Run

and this "works" with the only problem that the fzf TUI is not shown. But it 
does receive input, the output it produces when I input my specific input is 
correct.

I'm a bit stumped and don't really know how to debug that. Does python do 
something automatically which I have to do in nim manually?
    
    
    $ nim --version
    Nim Compiler Version 0.18.0 [Linux: amd64]
    Copyright (c) 2006-2018 by Andreas Rumpf
    
    active boot switches: -d:release -d:nativeStackTrace
    $ fzf --version
    0.17.4
    
    
    Run

Thanks in advance, syntonym

Reply via email to