Mail Archives: cygwin/1997/06/15/22:40:53
The test case below illustrates a problem with spawnlp. The correct
sequence of output should be something like:
first
second
exited
It is instead:
first
exited
second
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
software!
#include <process.h>
main()
{
spawnlp(_P_WAIT, "sh", "sh", "-c",
"echo first; exec sh -c \"sleep 2; echo second\"", 0);
printf("exited\n", ret);
exit(0);
}
--
http://www.bbc.com/ cgf AT bbc DOT 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 AT cygnus DOT com" with one line of text: "help".
- Raw text -