Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Answer: How to kill a process after calling fork?

by chromatic (Archbishop)
on Jun 20, 2000 at 05:56 UTC ( #18930=categorized answer: print w/replies, xml ) Need Help??

Q&A > programs and processes > How to kill a process after calling fork? - Answer contributed by chromatic

In the parent, if the fork call succeeds, $pid will contain the process ID of the child. You can then use the kill command to send any sort of signal to it (as you know the PID).
my $pid = fork(); if ($pid == 0) { # we're the child # exec something or other } else { sleep 10; # give the child a chance kill 1, $pid; # nighty-night }
Something along those lines will suffice.

Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (9)
As of 2019-12-16 10:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?