Hi there!

Thanx!

/G

----- Original Message ----- From: "zentara" <[EMAIL PROTECTED]>
To: <beginners@perl.org>
Sent: Monday, October 10, 2005 10:25 AM
Subject: Re: Kill child process?


On Sun, 9 Oct 2005 15:53:19 +0200, [EMAIL PROTECTED] (Gustav Wiberg)
wrote:

Hi there!

    #Signal-handling for Ctrl-C
   #
   $SIG{INT} = \&whenbreak;

#This triggers when CTRl-C.
#
     sub whenbreak {

      $SIG{INT} = \&whenbreak;
      warn "\n\nChildprocess killed.\n\n";
    }

How can I do that a background-process would not stop? (say that I only
want to break current child process, not the parent process also?)

You need to get the pid of the child process, then use kill on it.

Quite often, you need to use Proc::Killfam to kill the process, because
depending on how you create the child process, you may be getting
the pid of the controlling parent shell, not the child itself.

See "perldoc kill" and "perldoc Proc::Killfam"




--
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.11.13/126 - Release Date: 2005-10-09




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to