[MLton] Win32 Spawn's Seem Broken

Stephen Weeks MLton@mlton.org
Wed, 21 Jul 2004 11:07:29 -0700


> This seems to think spawne returns a PID.
> 
> But, the spawn sources say:
> 
> result = spawnve(0, path, 
>            (const char * const *)args,
>            (const char * const *)env);
> 
> The flag '0' does not indicate asynchronous, so this
> call actually blocks waiting for "path" to complete,
> then it provides its return code (0 in this case).

I just tested on my Cygwin machine and '0' seems to work fine in that
it causes spawnve to detach the process and to return the pid.  You
must be observing a difference between Cygwin and MinGW.

> 1.  Modify spawnp/spawne to use "NON_BLOCK" so that it
> returns a PID, rather than a return code?

As Matthew said, this is the way to go, but you only need to have it
take effect for the MinGW world.