diff options
author | Christopher Faylor <me@cgf.cx> | 2003-03-16 23:38:22 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2003-03-16 23:38:22 +0000 |
commit | 3edb5f76bc780b384a651f4d2c2a661e7e641086 (patch) | |
tree | 845dba4691aa8228d0160b266e337b4c7e1881e7 | |
parent | 5a436b4d53ebe28fdfccd0b3a7be26a650e7d617 (diff) | |
download | newlib-unlabeled-1.120.2.zip newlib-unlabeled-1.120.2.tar.gz newlib-unlabeled-1.120.2.tar.bz2 |
* fhandler_console.cc (fhandler_console::close): Correct check for current tty.github/unlabeled-1.120.2unlabeled-1.120.2
Add debugging output when console is freed.
(set_console_state_for_spawn): Add debugging output.
* fhandler_tty.cc (fhandler_tty_slave::open): Don't decrement console open flag
when vforking.
* sigproc.cc (sigproc_terminate): Fix debugging output.
* spawn.cc (handle): Eliminate second argument.
(spawn_guts): Reflect elimination of argument change to handle.
* syscalls.cc (setsid): Add debugging output when console is freed.
-rw-r--r-- | winsup/cygwin/spawn.cc | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc index f6863e8..f7bcbcc 100644 --- a/winsup/cygwin/spawn.cc +++ b/winsup/cygwin/spawn.cc @@ -180,7 +180,7 @@ find_exec (const char *name, path_conv& buf, const char *mywinenv, /* Utility for spawn_guts. */ static HANDLE -handle (int n, int direction) +handle (int n) { fhandler_base *fh = cygheap->fdtab[n]; @@ -188,9 +188,7 @@ handle (int n, int direction) return INVALID_HANDLE_VALUE; if (fh->get_close_on_exec ()) return INVALID_HANDLE_VALUE; - if (direction == 0) - return fh->get_handle (); - return fh->get_output_handle (); + return n ? fh->get_output_handle () : fh->get_handle (); } int @@ -591,15 +589,18 @@ spawn_guts (const char * prog_arg, const char *const *argv, si.lpReserved = NULL; si.lpDesktop = NULL; si.dwFlags = STARTF_USESTDHANDLES; - si.hStdInput = handle (0, 0); /* Get input handle */ - si.hStdOutput = handle (1, 1); /* Get output handle */ - si.hStdError = handle (2, 1); /* Get output handle */ + si.hStdInput = handle (0); /* Get input handle */ + si.hStdOutput = handle (1); /* Get output handle */ + si.hStdError = handle (2); /* Get output handle */ si.cb = sizeof (si); int flags = CREATE_DEFAULT_ERROR_MODE | GetPriorityClass (hMainProc); if (mode == _P_DETACH || !set_console_state_for_spawn ()) - flags |= DETACHED_PROCESS; + { + debug_printf ("mode %c= _P_DETACH", mode == _P_DETACH ? '=' : '!'); + flags |= DETACHED_PROCESS; + } if (mode != _P_OVERLAY) flags |= CREATE_SUSPENDED; |