[PATCH 2/3] Cygwin: pty: Fix console mode of non-cygwin apps in background.

Takashi Yano takashi.yano@nifty.ne.jp
Sun Dec 12 13:05:00 GMT 2021


- If the non-cygwin app is started in the background in pseudo
  console, the console mode is broken for the app. This patch fixes
  the issue.
---
 winsup/cygwin/fhandler_tty.cc | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc
index 904398179..cd0de9bc0 100644
--- a/winsup/cygwin/fhandler_tty.cc
+++ b/winsup/cygwin/fhandler_tty.cc
@@ -3384,7 +3384,7 @@ skip_create:
   if (get_ttyp ()->previous_output_code_page)
     SetConsoleOutputCP (get_ttyp ()->previous_output_code_page);
 
-  do
+  if (get_ttyp ()->getpgid () == myself->pgid)
     {
       termios &t = get_ttyp ()->ti;
       DWORD mode;
@@ -3409,7 +3409,6 @@ skip_create:
 	mode |= DISABLE_NEWLINE_AUTO_RETURN;
       SetConsoleMode (hpConOut, mode);
     }
-  while (false);
 
   return true;
 
-- 
2.34.1



More information about the Cygwin-patches mailing list