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

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?

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2020-10-31 08:10 GMT
Find Nodes?
    Voting Booth?
    My favourite web site is:

    Results (287 votes). Check out past polls.