This is the mail archive of the cygwin-developers@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: More spawn & Windows processes


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]