From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from conssluserg-06.nifty.com (conssluserg-06.nifty.com [210.131.2.91]) by sourceware.org (Postfix) with ESMTPS id E19163858D20 for ; Fri, 14 Apr 2023 03:21:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E19163858D20 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=nifty.ne.jp Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=nifty.ne.jp Received: from HP-Z230 (aj135041.dynamic.ppp.asahi-net.or.jp [220.150.135.41]) (authenticated) by conssluserg-06.nifty.com with ESMTP id 33E3LECh021008; Fri, 14 Apr 2023 12:21:14 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-06.nifty.com 33E3LECh021008 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.ne.jp; s=dec2015msa; t=1681442475; bh=+BWwTJ7HasukIMIB46A+SIOlUIHQhMMbz2uDhluR3FQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=2+UOTkzgvXjhcw0D57VVYKV+cQ9Ay+G00pr9Mdov5jq6YT6KV9VbIvy9/D/oy5Yyy djJrJ0Wh8rrw6MJwXlztmF2J2XmjElxzcoZOrdhsBvguDES40F4x5851IusuQ6tmbA 4BytiIOe+N0jdRpdG9P9hm6AWGoXoCCjJJYRdqhhS4LhJ3yd04d4NWJLg6SL2hm2Mf QtcIEzfSHgmmTUvp59GzvoFQBL5c3E25ujKKWFT7n9lkQG6uWhHyUFG0GYUo6xqCJd DLUrA7JXeNRx8be2otaiMegDuX3DYxJQwM1CQ5FXr/HucaYe9LEByhzpdxChzze1xm 0yxoqQRPjOOPA== X-Nifty-SrcIP: [220.150.135.41] Date: Fri, 14 Apr 2023 12:21:15 +0900 From: Takashi Yano To: cygwin@cygwin.com Cc: Wladislav Artsimovich Subject: Re: [Bug] No Keyboard input when using interactive commands with stdin via pipes Message-Id: <20230414122115.0717443f466c083f1c20a469@nifty.ne.jp> In-Reply-To: <20230411082225.Horde._PTWsCm_YLV1M7wEp3hKuyr@localhost> References: <20230411082225.Horde._PTWsCm_YLV1M7wEp3hKuyr@localhost> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32) Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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