Cygwin: console: Fix console mode of non-cygwin apps in background.

- If the non-cygwin app is started in the background in console, the
  console mode is broken for the app. This patch fixes the issue.
This commit is contained in:
Takashi Yano 2021-12-12 21:26:57 +09:00
parent 5e23f2376e
commit 22953c530c
1 changed files with 5 additions and 2 deletions

View File

@ -631,11 +631,14 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv,
cons_ti = &((tty *)cons->tc ())->ti; cons_ti = &((tty *)cons->tc ())->ti;
cons_owner = cons->get_owner (); cons_owner = cons->get_owner ();
} }
tty::cons_mode conmode =
(ctty_pgid && ctty_pgid == myself->pgid) ?
tty::native : tty::restore;
if (fd == 0) if (fd == 0)
fhandler_console::set_input_mode (tty::native, fhandler_console::set_input_mode (conmode,
cons_ti, cons->get_handle_set ()); cons_ti, cons->get_handle_set ());
else if (fd == 1 || fd == 2) else if (fd == 1 || fd == 2)
fhandler_console::set_output_mode (tty::native, fhandler_console::set_output_mode (conmode,
cons_ti, cons->get_handle_set ()); cons_ti, cons->get_handle_set ());
} }
} }