[BUG] spawnlp(_P_WAIT, ...) confused if spawned processes execs

Chris Faylor cgf@bbc.com
Sun Jun 15 19:07:00 GMT 1997

The test case below illustrates a problem with spawnlp.  The correct
sequence of output should be something like:


It is instead:


Looking at the sources, it appears that the problem is that the spawn
functions only wait for the Windows process that *they* created.  If I
read the way 'exec' works correctly, it essentially creates a new Windows
process, performs some cygnus magic on it, and "jumps to it", terminating
the "parent" process.  This erroneously signals the spawn function that
its child has exited.  Well, its Windows child has, really, but its
Unix child hasn't.

I once again, think that this would be difficult to fix, but maybe Sergey
will prove me wrong.  I love to be proven wrong when the result is better

#include <process.h>
spawnlp(_P_WAIT, "sh", "sh", "-c",
	"echo first; exec sh -c \"sleep 2; echo second\"", 0);
printf("exited\n", ret);
http://www.bbc.com/	cgf@bbc.com			"Strange how unreal
VMS=>UNIX Solutions	Boston Business Computing	 the real can be."
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

More information about the Cygwin mailing list