In the commit 0bfd91d57863, the behaviour of the tty::restore was
changed so that the console mode is set to the previouslly stored
console mode. Therefore, the console mode for the background non-
cygwin app should not be set to tty::restore anymore in setup_for_
non_cygwin_app(). This should have been fixed in that commit.
This patch belatedly fixes it.

Fixes: 0bfd91d57863 ("Cygwin: console: tty::restore really restores the 
previous mode")
Signed-off-by: Takashi Yano <[email protected]>
---
 winsup/cygwin/fhandler/console.cc | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/winsup/cygwin/fhandler/console.cc 
b/winsup/cygwin/fhandler/console.cc
index 16352d04d..5a55d122e 100644
--- a/winsup/cygwin/fhandler/console.cc
+++ b/winsup/cygwin/fhandler/console.cc
@@ -905,13 +905,14 @@ fhandler_console::setup_for_non_cygwin_app ()
   /* Setting-up console mode for non-cygwin app. */
   /* If conmode is set to tty::native for non-cygwin apps
      in background, tty settings of the shell is reflected
-     to the console mode of the app. So, use tty::restore
-     for background process instead. */
-  tty::cons_mode conmode =
-    (get_ttyp ()->getpgid ()== myself->pgid) ? tty::native : tty::restore;
-  set_input_mode (conmode, &tc ()->ti, get_handle_set ());
-  set_output_mode (conmode, &tc ()->ti, get_handle_set ());
-  set_disable_master_thread (true, this);
+     to the console mode of the app. So, do not change the
+     console mode. */
+  if (get_ttyp ()->getpgid () == myself->pgid)
+    {
+      set_input_mode (tty::native, &tc ()->ti, get_handle_set ());
+      set_output_mode (tty::native, &tc ()->ti, get_handle_set ());
+      set_disable_master_thread (true, this);
+    }
 }
 
 void
-- 
2.45.1

Reply via email to