diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index a68b4fb1c..e876e5449 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,11 @@ +2008-06-12 Corinna Vinschen + + * fhandler.h (set_console_state_for_spawn): Drop declaration. + * fhandler_console.cc (set_console_state_for_spawn): Remove. + (fhandler_console::open): Set console state last. Don't set + ENABLE_PROCESSED_INPUT flag. + * spawn.cc (spawn_guts): Drop call to set_console_state_for_spawn. + 2008-06-11 Corinna Vinschen * path.cc (get_nt_native_path): Drop considerations for DOS devices. diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index 82541be6b..1430b28ed 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -1423,6 +1423,4 @@ class select_stuff device_specific_serial (0), device_specific_mailslot (0) {} }; - -void __stdcall set_console_state_for_spawn (bool); #endif /* _FHANDLER_H_ */ diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc index 579598a26..076e2338c 100644 --- a/winsup/cygwin/fhandler_console.cc +++ b/winsup/cygwin/fhandler_console.cc @@ -121,34 +121,6 @@ tty_list::get_tty (int n) return &nada; } -/* Determine if a console is associated with this process prior to a spawn. - If it is, then just return. If the console has been initialized, then - set it into a more friendly state for non-cygwin apps. */ -void __stdcall -set_console_state_for_spawn (bool iscyg) -{ - if (fhandler_console::need_invisible () || iscyg - || (myself->ctty >= 0 && myself->ctty != TTY_CONSOLE)) - return; - - HANDLE h = CreateFile ("CONIN$", GENERIC_READ, FILE_SHARE_WRITE, - &sec_none_nih, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, - NULL); - - if (h == INVALID_HANDLE_VALUE) - return; - - if (shared_console_info != NULL) - { - SetConsoleMode (h, ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT | ENABLE_PROCESSED_INPUT); - shared_console_info->tty_min_state.rstcons (true); - } - - CloseHandle (h); - - return; -} - /* The results of GetConsoleCP() and GetConsoleOutputCP() cannot be cached, because a program or the user can change these values at any time. */ @@ -647,16 +619,15 @@ fhandler_console::open (int flags, mode_t) dev_state->set_default_attr (); } - DWORD cflags; - if (GetConsoleMode (get_io_handle (), &cflags)) - { - cflags |= ENABLE_PROCESSED_INPUT; - SetConsoleMode (get_io_handle (), ENABLE_WINDOW_INPUT | ENABLE_MOUSE_INPUT | cflags); - } - tc->rstcons (false); set_open_status (); cygheap->manage_console_count ("fhandler_console::open", 1); + + DWORD cflags; + if (GetConsoleMode (get_io_handle (), &cflags)) + SetConsoleMode (get_io_handle (), + ENABLE_WINDOW_INPUT | ENABLE_MOUSE_INPUT | cflags); + debug_printf ("opened conin$ %p, conout$ %p", get_io_handle (), get_output_handle ()); diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc index a5856489a..c3d544e5a 100644 --- a/winsup/cygwin/spawn.cc +++ b/winsup/cygwin/spawn.cc @@ -441,8 +441,6 @@ spawn_guts (const char *prog_arg, const char *const *argv, if (mode == _P_DETACH) c_flags |= DETACHED_PROCESS; - else - set_console_state_for_spawn (real_path.iscygexec ()); if (mode != _P_OVERLAY) myself->exec_sendsig = NULL;