piotrmurach / tty-prompt

A beautiful and powerful interactive command line prompt
https://ttytoolkit.org
MIT License
1.47k stars 136 forks source link

select hangs after a pipe #168

Closed Nakilon closed 3 years ago

Nakilon commented 3 years ago

Describe the problem

select does not work if ruby was called after a pipe

Steps to reproduce the problem

this works fine

ruby -r tty-prompt -e "TTY::Prompt.new.select "1", [2,3]"

this "hangs"

echo 123 | ruby -r tty-prompt -e "p gets; TTY::Prompt.new.select "1", [2,3]"

Describe your environment

Nakilon commented 3 years ago
echo 123 | ruby -r tty-prompt -e "p gets; \$stdin = open '/dev/tty'; TTY::Prompt.new.select "1", [2,3]"