]> sourceware.org Git - newlib-cygwin.git/commitdiff
Cygwin: pty: Fix reading CONIN$ when stdin is not a pty.
authorTakashi Yano <takashi.yano@nifty.ne.jp>
Fri, 14 Apr 2023 01:52:08 +0000 (10:52 +0900)
committerTakashi Yano <takashi.yano@nifty.ne.jp>
Fri, 14 Apr 2023 02:23:51 +0000 (11:23 +0900)
Previously, the pty master sends inputs to the pipe for cygwin app
even when pseudo console is activated if stdin is not the pty.
This causes the problem that key input is not sent to non cygwin
app even if the app opens CONIN$. This patch sets switch_to_nat_pipe
to true regardless whether stdin is the pty or not to allow that case.

https://cygwin.com/pipermail/cygwin/2023-April/253424.html

Reported-by: Wladislav Artsimovich <cygwin@frost.kiwi>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
winsup/cygwin/fhandler/pty.cc
winsup/cygwin/release/3.4.7

index e9a379b1c302e12eab40e21a99c71e8adfe72cda..aa7ceb0ba4384aca76cef7a54a9f204f26908f1e 100644 (file)
@@ -3274,6 +3274,11 @@ fhandler_pty_slave::setup_pseudoconsole ()
       return false;
     }
 
+  /* Set switch_to_nat_pipe regardless whether stdin is the pty or not
+     so that the non-cygwin app can work when it opens CONIN$. */
+  bool switch_to_nat_pipe_orig = get_ttyp ()->switch_to_nat_pipe;
+  get_ttyp ()->switch_to_nat_pipe = true;
+
   HANDLE hpConIn, hpConOut;
   if (get_ttyp ()->pcon_activated)
     { /* The pseudo console is already activated. */
@@ -3551,6 +3556,7 @@ cleanup_pseudo_console:
       CloseHandle (tmp);
     }
 fallback:
+  get_ttyp ()->switch_to_nat_pipe = switch_to_nat_pipe_orig;
   return false;
 }
 
index 2c305ec5f320a4faaa43e95ff4891df6116c6f8d..941519ebc86ab2d17fb941fa294b705f2d781029 100644 (file)
@@ -9,3 +9,6 @@ Bug Fixes
 
 - Align behaviour of dirname in terms of leading slashes to POSIX:
   https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html
+
+- Fix reading CONIN$ in non cygwin apps when stdin is not a pty.
+  Addresses https://cygwin.com/pipermail/cygwin/2023-April/253424.html
This page took 0.036966 seconds and 5 git commands to generate.