spawn doesn't return for non-cygwin programs (and also is unbreakable)

Volker Quetschke quetschke@scytek.de
Tue Dec 26 00:48:00 GMT 2006


Hi!

I recently tripped over the following problem: If a non-cygwin
program gets started by cygwin's spawnvp() the spawn doesn't return
until the started program returns.

To illustrate the problem just compile attached the attached
breaktestwin.c file as a cygwin executable

$ gcc breaktestwin.c -o breaktestwin.exe

and the attached wsleep.c as a native W32 executable

$ gcc -mno-cygwin wsleep.c -o wsleep.exe

and start breaktestwin.exe.

$ ./breaktestwin.exe

You will see that the "Started child  ..." message will not
appear until wsleep finishes.

This problem is actually known since 2001 but I thought it's
OK to mention it again. See:
<http://www.cygwin.com/ml/cygwin/2001-03/msg00068.html>

Another point that did not get mentioned AFAIK is that the
program is not interruptible by CTRL-c while spawnvp() is
waiting for it's "child". (Only true if CYGWIN=tty or when
rxvt or something that handles tty's correctly is used.)

Try hitting CTRL-c while breaktestwin.exe is running from
a tty enable shell. The SIGINT will be handled after the
spawnvp() finishes.


Regards

   Volker


-- 
PGP/GPG key  (ID: 0x9F8A785D)  available  from  wwwkeys.de.pgp.net
key-fingerprint 550D F17E B082 A3E9 F913  9E53 3D35 C9BA 9F8A 785D
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: breaktestwin.c
URL: <http://cygwin.com/pipermail/cygwin/attachments/20061226/64a5690a/attachment.c>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: wsleep.c
URL: <http://cygwin.com/pipermail/cygwin/attachments/20061226/64a5690a/attachment-0001.c>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 248 bytes
Desc: OpenPGP digital signature
URL: <http://cygwin.com/pipermail/cygwin/attachments/20061226/64a5690a/attachment.sig>


More information about the Cygwin mailing list