* fhandler.h (fhandler_pipe::fixup_in_child): Declare new function.

(fhandler_console::invisible_console): Declare new variable.
(fhandler_console::need_invisible): Ditto.
(fhandler_console::has_a): Ditto.
* fhandler_console.cc (set_console_state_for_spawn): Eliminate return value.
Set up an invisible console if necessary prior to spawning.
(fhandler_console::invisible_console): Define.
* fhandler_tty.cc (fhandler_tty_slave::open): Use
fhandler_console::invisible_console to setup an invisible console.
* pipe.cc (fhandler_pipe::fixup_in_child): Define new function from
fixup_after_exec.
(fhandler_pipe::fixup_after_exec): Use fixup_in_child when appropriate.
(fhandler_pipe::fixup_after_fork): Ditto.
* spawn.cc (handle): Reorganize and modernize a little.
(spawn_guts): Rely on set_console_state_for_spawn to set the console into the
right state but don't create the process with "detached" flag if we have no
controlling tty since that confuses 'cmd'.
* dtable.cc (dtable::stdio_init): Don't set console as controlling terminal if
we have an invisible console.
* sigproc.cc (child_info::sync): Use correct name in ForceCloseHandle1.
This commit is contained in:
Christopher Faylor
2005-12-19 04:34:13 +00:00
parent ca9271d1b6
commit 65438ec635
8 changed files with 119 additions and 64 deletions

View File

@@ -200,17 +200,20 @@ find_exec (const char *name, path_conv& buf, const char *mywinenv,
/* Utility for spawn_guts. */
static HANDLE
handle (int n, int direction)
handle (int fd, int direction)
{
fhandler_base *fh = cygheap->fdtab[n];
HANDLE h;
cygheap_fdget cfd (fd);
if (!fh)
return INVALID_HANDLE_VALUE;
if (fh->close_on_exec ())
return INVALID_HANDLE_VALUE;
if (direction == 0)
return fh->get_handle ();
return fh->get_output_handle ();
if (cfd < 0)
h = INVALID_HANDLE_VALUE;
else if (cfd->close_on_exec ())
h = INVALID_HANDLE_VALUE;
else if (direction == 0)
h = cfd->get_handle ();
else
h = cfd->get_output_handle ();
return h;
}
int
@@ -580,7 +583,9 @@ 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;
if (mode == _P_DETACH || !set_console_state_for_spawn ())
set_console_state_for_spawn ();
if (mode == _P_DETACH)
flags |= DETACHED_PROCESS;
if (mode != _P_OVERLAY)