public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Takashi Yano <takashi.yano@nifty.ne.jp>
To: cygwin@cygwin.com
Cc: Wladislav Artsimovich <cygwin@frost.kiwi>
Subject: Re: [Bug] No Keyboard input when using interactive commands with stdin via pipes
Date: Fri, 14 Apr 2023 12:21:15 +0900	[thread overview]
Message-ID: <20230414122115.0717443f466c083f1c20a469@nifty.ne.jp> (raw)
In-Reply-To: <20230411082225.Horde._PTWsCm_YLV1M7wEp3hKuyr@localhost>

On Tue, 11 Apr 2023 08:22:25 +0000
Wladislav Artsimovich wrote:
> 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?

Thnaks for the report.

I cound reproduce your problem by:
$ yes | cat -n | more.com
(not /usr/bin/more but /cygdrive/c/WINDOWS/system32/more.com)

Currently, the keybord inputs are sent only to 'yes' rather than 'more.com'
in the above case.

This does not happen in:
$ yes | cat -n | less
because less is a cygwin program which opens '/dev/tty' rather than 'CONIN$'.

Anyway, I'll fix that.

-- 
Takashi Yano <takashi.yano@nifty.ne.jp>

      reply	other threads:[~2023-04-14  3:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-11  8:22 Wladislav Artsimovich
2023-04-14  3:21 ` Takashi Yano [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230414122115.0717443f466c083f1c20a469@nifty.ne.jp \
    --to=takashi.yano@nifty.ne.jp \
    --cc=cygwin@cygwin.com \
    --cc=cygwin@frost.kiwi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).