Handles to unix executables exec'd with CreateProcess()

Eric Pouech eric.pouech at wanadoo.fr
Sun Apr 30 04:06:23 CDT 2006

Thomas Kho wrote:
> It seems that it is not currently possible to get the exit code of a
> unix program executed with _wspawnv(_P_WAIT, [unix app], [args])
> because CreateProcess() does not return a handle to the new process.
> _wspawnv() uses the handle to WaitForSingleObject() the end of
> execution and also needs it to GetExitCodeProcess().
> Is implementation of handles to unix processes something that could be
> done and pass muster, or just a corner case for a feature that doesn't
> add to Windows compatibility?
> FWIW, my application for this is to run a shell script and get the
> return value. Under Windows, I run the shell script with Cygwin; under
> Wine, I had originally planned to execute it directly.
the point is even larger: a unix subprocess doesn't get a handle, so all 
the operations requiring such handle don't work (suspend/resume, 
debugging, waiting for the end of sub process, exit code, priority, 
affinity, enumeration...)

One of the easiest way would be to use a wrapper (being a winelib app), 
that could work around some of the issues (wait for the end, exit code, 
enumeration - to some extent -...). Including this behavior directly 
into wine kernel code would be more complicated, still doable.

That wrapper would be simpler than winevdm (as it shouldn't support 
inter-process communication).

Eric Pouech

More information about the wine-devel mailing list