More spawn & Windows processes
Christopher Faylor
me@cgf.cx
Mon Dec 27 00:29:00 GMT 2004
On Sun, Dec 26, 2004 at 12:45:58PM -0500, Pierre A. Humblet wrote:
>With the recent changes I think that spawn(P_DETACH) should be fine.
>However neither spawn(P_WAIT) nor spawn(P_NOWAIT) will handle Windows
>processes correctly: the exit status will not be passed.
>
>If it was only for P_WAIT, we could simply create a subproc_ready event
>in that case and reuse child_info::sync. synch is called from
>spawn_guts, which will wait for the Windows process to finish, and all
>will be fine. However we can't let spawn_guts wait in the P_NOWAIT
>case.
>
>One way out is to move the child_info::sync functionality to the
>beginning of the proc_waiter thread. Before trying to read the pipe,
>it would WaitFor(subproc_ready, process) and set the exitstatus if
>needed. The nice thing is that this will also handle the EXEC and
>P_DETACH cases. If we do that we should look into moving the
>subproc_ready event to the pinfo.
Why not just generically detect when exitcode hasn't been set and use
the value returned from GetExitCodeProcess in proc_waiter? That is the
way I was originally going to handle the problem with getting the exit
code from processes that had been killed via the task manager. I'll
just implement that. It eliminates the extra code in init.cc and just
moves the detection from child_info::sync.
cgf
More information about the Cygwin-developers
mailing list