Subject: [BUG] spawnlp(_P_WAIT, ...) confused if spawned processes execs
From: [email-masked] (Chris Faylor)

15 Jun 1997 22:40:53 -0700
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
Reply-To: [email-masked]
X-Newsreader: trn 4.0-test57 (27 Apr 97)
Original-To: [email-masked]
X-Mailer: Perl5 Mail::Internet v1.28
Original-Sender: [email-masked]

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/	[email-masked]			"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
"[email-masked]" with one line of text: "help".