From: cgf AT bbc DOT com (Chris Faylor) Subject: [BUG] spawnlp(_P_WAIT, ...) confused if spawned processes execs 15 Jun 1997 22:40:53 -0700 Approved: cygnus DOT gnu-win32 AT cygnus DOT com Distribution: cygnus Message-ID: Reply-To: cgf AT bbc DOT com X-Newsreader: trn 4.0-test57 (27 Apr 97) Original-To: gnu-win32 AT cygnus DOT com X-Mailer: Perl5 Mail::Internet v1.28 Original-Sender: owner-gnu-win32 AT cygnus DOT com 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 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".