[comp.lang.perl] fork

kayvan@mrspoc.transact.com (Kayvan Sylvan) (02/17/90)

Looking at eval.c, it seems that the perl's wait() ignores certain
signals. I don't think this is correct behavior.

I have an application where I want to spawn a subprocess (which
setpgrp()'s and goes about its merry way) and at the same time I want
the parent to wait() for the child to finish. Now, if I want to
interrupt the parent, I should be able to (without killing the child,
so system() will not do).

Is there anything wrong with commenting out the signal(SIGINT, SIG_IGN) 
and the other SIG_IGN line in the O_WAIT case in eval.c??

Why are they there in the first place?

			---Kayvan

| Kayvan Sylvan @ Transact Software, Inc. -*-  Los Altos, CA (415) 961-6112 |
| Internet: kayvan@{mrspoc.Transact.com, eris.berkeley.edu, net.bio.net}    |
| UUCP: ...!{apple,pyramid,bionet,mips}!mrspoc!kayvan "No space for saying" |

lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) (02/18/90)

In article <2641@uvaarpa.virginia.edu> kayvan@mrspoc.transact.com writes:
: Looking at eval.c, it seems that the perl's wait() ignores certain
: signals. I don't think this is correct behavior.

You're probably right.

: I have an application where I want to spawn a subprocess (which
: setpgrp()'s and goes about its merry way) and at the same time I want
: the parent to wait() for the child to finish. Now, if I want to
: interrupt the parent, I should be able to (without killing the child,
: so system() will not do).

It would probably be possible even now by calling wait thru syscall().

: Is there anything wrong with commenting out the signal(SIGINT, SIG_IGN) 
: and the other SIG_IGN line in the O_WAIT case in eval.c??

I'll do that in patch 9 and see if anyone screams.

: Why are they there in the first place?

Because the code was copied in from the mypopen routine.  But that's
a higher level routine, and most system()ish routines behave like that.
But wait should be a low level operator.  You can always ignore the
signals yourself around a wait if you like, but if the wait ignores
them then you can't unignore them.  >>patch9

Larry