Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: forking, waiting, and killing child pidsby halfcountplus (Hermit) |
on Apr 11, 2012 at 18:48 UTC ( [id://964601]=note: print w/replies, xml ) | Need Help?? |
$snoop in the parent is the child pid. Unfortunately, system() performs a further fork, (and I think tcpdump would be still another child of that) -- and killing the parent doesn't kill the child. HOWEVER, if you use exec() instead of system(), there are no additional children spawned, so you can stop the process by killing the fork. Just beware, there should not be any calls after exec(), because it doesn't return.
Should work. qv. exec
In Section
Seekers of Perl Wisdom
|
|