Index: dtable.cc =================================================================== RCS file: /cvs/uberbaum/winsup/cygwin/dtable.cc,v retrieving revision 1.43 diff -u -p -2 -r1.43 dtable.cc --- dtable.cc 2001/07/26 19:22:23 1.43 +++ dtable.cc 2001/08/02 06:38:38 @@ -507,4 +507,6 @@ dtable::fixup_after_exec (HANDLE parent) first_fd_for_open = 0; fhandler_base *fh; + char fds_fixup_event_name [MAX_PATH]; + HANDLE fds_fixup_event = NULL; for (size_t i = 0; i < size; i++) if ((fh = fds[i]) != NULL) @@ -522,4 +524,14 @@ dtable::fixup_after_exec (HANDLE parent) } } + __small_sprintf (fds_fixup_event_name, FDS_FIXUP_EVENT_NAME, GetCurrentProcessId ()); + fds_fixup_event = OpenEvent (EVENT_MODIFY_STATE, FALSE, fds_fixup_event_name); + if (fds_fixup_event) + { + SetEvent (fds_fixup_event); + debug_printf ("fds_fixup signalled"); + CloseHandle (fds_fixup_event); + } + else + debug_printf ("cannot open fds_fixup event, %E"); } Index: dtable.h =================================================================== RCS file: /cvs/uberbaum/winsup/cygwin/dtable.h,v retrieving revision 1.10 diff -u -p -2 -r1.10 dtable.h --- dtable.h 2001/07/26 00:10:52 1.10 +++ dtable.h 2001/08/02 06:38:38 @@ -11,4 +11,5 @@ details. */ /* Initial and increment values for cygwin's fd table */ #define NOFILE_INCR 32 +#define FDS_FIXUP_EVENT_NAME "cygwin.fds_fixup.%ld" #include "thread.h" Index: fhandler_tty.cc =================================================================== RCS file: /cvs/uberbaum/winsup/cygwin/fhandler_tty.cc,v retrieving revision 1.41 diff -u -p -2 -r1.41 fhandler_tty.cc --- fhandler_tty.cc 2001/07/26 19:22:24 1.41 +++ fhandler_tty.cc 2001/08/02 06:38:43 @@ -220,6 +220,9 @@ process_input (void *) int nraw = tty_master->console->read ((void *) rawbuf, (size_t) INP_BUFFER_SIZE); + if (nraw < 0) + break; (void) tty_master->line_edit (rawbuf, nraw); } + return 0; } Index: spawn.cc =================================================================== RCS file: /cvs/uberbaum/winsup/cygwin/spawn.cc,v retrieving revision 1.83 diff -u -p -2 -r1.83 spawn.cc --- spawn.cc 2001/07/26 19:22:24 1.83 +++ spawn.cc 2001/08/02 06:38:44 @@ -572,4 +572,8 @@ skip_arg_parsing: flags |= CREATE_SUSPENDED; + char fds_fixup_event_name [MAX_PATH]; + HANDLE fds_fixup_event = NULL; + __small_sprintf (fds_fixup_event_name, FDS_FIXUP_EVENT_NAME, pi.dwProcessId); + fds_fixup_event = CreateEvent (&sec_all_nih, FALSE, FALSE, fds_fixup_event_name); /* Build windows style environment list */ @@ -754,6 +758,6 @@ skip_arg_parsing: if (mode == _P_OVERLAY) { - int nwait = 3; - HANDLE waitbuf[3] = {pi.hProcess, signal_arrived, spr}; + int nwait = 4; + HANDLE waitbuf[4] = {pi.hProcess, signal_arrived, spr, fds_fixup_event}; for (int i = 0; i < 100; i++) { @@ -782,4 +786,7 @@ skip_arg_parsing: } break; + case WAIT_OBJECT_0 + 3: + close_all_files (); + continue; case WAIT_FAILED: system_printf ("wait failed: nwait %d, pid %d, winpid %d, %E",