diff options
author | Christopher Faylor <me@cgf.cx> | 2005-12-19 19:04:14 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2005-12-19 19:04:14 +0000 |
commit | 7a01aa546d49d670cb4c286752522850a81a2ccd (patch) | |
tree | 7478d811be0be21116d1d61f36accf8b0ccbfaca | |
parent | 7e958b2e6abfb332eb65df9100783b69508a3403 (diff) | |
download | newlib-7a01aa546d49d670cb4c286752522850a81a2ccd.zip newlib-7a01aa546d49d670cb4c286752522850a81a2ccd.tar.gz newlib-7a01aa546d49d670cb4c286752522850a81a2ccd.tar.bz2 |
* fhandler.h (set_console_state_for_spawn): Add an argument to the declaration.
* fhandler_console.cc (set_console_state_for_spawn): Ditto for the definition.
Only set invisible console for non-cygwin process. Remove debugging leftover.
* spawn.cc (spawn_guts): Pass argument denoting whether this is a cygwin
process to set_console_state_for_spawn and only call this function when
exec'ing.
-rw-r--r-- | winsup/cygwin/ChangeLog | 11 | ||||
-rw-r--r-- | winsup/cygwin/fhandler.h | 2 | ||||
-rw-r--r-- | winsup/cygwin/fhandler_console.cc | 7 | ||||
-rw-r--r-- | winsup/cygwin/spawn.cc | 3 |
4 files changed, 16 insertions, 7 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index afaa417..8ccb374 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,14 @@ +2005-12-19 Christopher Faylor <cgf@timesys.com> + + * fhandler.h (set_console_state_for_spawn): Add an argument to the + declaration. + * fhandler_console.cc (set_console_state_for_spawn): Ditto for the + definition. Only set invisible console for non-cygwin process. Remove + debugging leftover. + * spawn.cc (spawn_guts): Pass argument denoting whether this is a + cygwin process to set_console_state_for_spawn and only call this + function when exec'ing. + 2005-12-19 Corinna Vinschen <corinna@vinschen.de> * mmap.cc (fhandler_dev_zero::mmap): Call VirtualFree(MEM_RELEASE) diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index e948403..034281f 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -1364,6 +1364,6 @@ class select_stuff device_specific_mailslot (0) {} }; -void __stdcall set_console_state_for_spawn (); +void __stdcall set_console_state_for_spawn (bool) __attribute__ ((regparm (1))); #endif /* _FHANDLER_H_ */ diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc index 460b0dd..3fd139d 100644 --- a/winsup/cygwin/fhandler_console.cc +++ b/winsup/cygwin/fhandler_console.cc @@ -138,14 +138,13 @@ 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 we'll return 1. 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 () +set_console_state_for_spawn (bool noncygwin_process) { - if (fhandler_console::need_invisible ()) + if (noncygwin_process && fhandler_console::need_invisible ()) return; HANDLE h = CreateFile ("CONIN$", GENERIC_READ, FILE_SHARE_WRITE, @@ -1849,7 +1848,7 @@ fhandler_console::need_invisible () b = AllocConsole (); // will cause flashing if workstation // stuff fails debug_printf ("h (%p), horig (%p)", h, horig); - if (0 && horig && h && h != horig && SetProcessWindowStation (horig)) + if (horig && h && h != horig && SetProcessWindowStation (horig)) CloseHandle (h); termios_printf ("%d = AllocConsole (), %E", b); invisible_console = true; diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc index df5cde1..ba16ef7 100644 --- a/winsup/cygwin/spawn.cc +++ b/winsup/cygwin/spawn.cc @@ -583,8 +583,6 @@ spawn_guts (const char * prog_arg, const char *const *argv, sigproc_printf ("priority class %d", flags); flags |= CREATE_DEFAULT_ERROR_MODE | CREATE_SEPARATE_WOW_VDM; - set_console_state_for_spawn (); - if (mode == _P_DETACH) flags |= DETACHED_PROCESS; @@ -612,6 +610,7 @@ spawn_guts (const char * prog_arg, const char *const *argv, ProtectHandle (cygheap->pid_handle); else system_printf ("duplicate to pid_handle failed, %E"); + set_console_state_for_spawn (real_path.iscygexec ()); } /* Some file types (currently only sockets) need extra effort in the parent |