Hi Curtis,

> I'm trying to run a program (fzf - a really useful ncurses text fuzzy
> finder) and read its output using (in), but I'm not getting it to
> work.

Hmm, hard to tell from here, but if it uses ncurses it probably switches the
terminal to some raw mode, and things get messed up.

> : (in '(fzf) (line T))
> Failed to read /dev/tty

Probably stdout goes directly to /dev/tty instead of the file descriptor of that
pipe, or something like that.


> I even tried to put the above command in an executable file with the
> following contents:
> 
> #!/bin/bash
> # saved in test.sh
> cat locations.csv | fzf --multi
> 
> then call it like:
> (in '("./test.sh") (line T))
> 
> but it just freezes the terminal and I have to forcible kill the script.

Does it really freeze? I rather think that 'line' keeps waiting for data that
never arrive.

You could find out the PID of the pil process with 'ps' and then do

   $ strace -p PID

to see where it is waiting.


> If I change the script's contents to:
> 
> #!/bin/bash
> # saved in test.sh
> #cat locations.csv | fzf --multi
> echo hello
> 
> then (in '("./test.sh") (line T)) works.

Just an 'echo' works because it does not blow up stdout.


You have this problem with all processes that modify the terminal settings. Try
to pipe the output of 'vi' or 'w3m' and you'll see similar effects. Optimal is
if the program das a kind of -dump option as 'lynx' does.

☺/ A!ex

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to