[Bug] No Keyboard input when using interactive commands with stdin via pipes

Wladislav Artsimovich cygwin@frost.kiwi
Tue Apr 11 08:22:25 GMT 2023


Dear Cygwin users,
 
there appears to be a bug or a missing implementation detail in either unix pipes or ConPTY, which prevents interactive console programs from receiving keyboard input, when they get stdin via a pipe.
This report concerns the following Github issue, originally started in the MinTTY Terminal emulator Repo: https://github.com/mintty/mintty/issues/1210
 
There are multiple programs, which fail to receive any kind of keyboard input when used in MinTTY and when their stdin input is supplied via a pipe.
This has been reported multiple times in the MinTTY repo already.
 
Examples include: 
 - `fzf`, which works normally when being called, but stops working properly if it receives a file list via a pipe. Eg.: `fzf` by itself works fine. but `find . | fzf` fails.
 - By extension, the zsh plugin fzf-plugin fails for the same reason, when opening the command history
 - The program fx ( https://github.com/antonmedv/fx ) which successfully receives keyboard input for navigating a json file, Eg.: `curl -s https://api.openai.com/v1/chat/completions -H 'Content-Type: application/json' > test.json; fx test.json` but fails when getting the json data as a direct pipe: `curl -s https://api.openai.com/v1/chat/completions -H 'Content-Type: application/json' | fx`
 
This happens with MinTTY accessing the MSYS2 environment on Windows. Interestingly enough, this does not happen with Alacritty accessing the MSYS2 environment on Windows. With Alacritty everything is fine, which made me initially suspect MinTTY as being the culprit. However, the MinTTY repo lead diagnosed this issue to come from Cygwin, which is why I write report the bug in this mailing list.
 
Is there something that can be done about this? Can I provide additional debug info or logs to help fix this?
 
Best regards,
 
Vlad


More information about the Cygwin mailing list