NAME

App::Chart::Proc::ChildPid -- child subprocess pid object

SYNOPSIS

use App::Chart::Proc::ChildPid;
my $cp = App::Chart::Proc::ChildPid->new ($pid);
$cp->kill_and_wait;

DESCRIPTION

App::Chart::Proc::ChildPid keeps hold of a process ID which is a child of the current process. If the ChildPid object is destroyed the child is killed and waited, thus protecting against creation of zombies.

FUNCTIONS

App::Chart::Proc::ChildPid->new ($pid)

Create and return a new ChildPid holding process ID $pid. There's no check that $pid is actually a child of the current process.

$cp->kill ()
$cp->kill ($sig)

Do a kill on the child process, sending it SIGTERM or the given signal $sig (a signal name or number). The return is as per the core kill function, ie. 1 if successful, or 0 if no processes signalled (because the child has been waited).

$cp->wait()

Do a wait on the child process and return its exit status. If the child has already been waited the return is -1 with $! set to ECHILD (no such child).

$cp->kill_and_wait()

Do a kill and wait combination on the child process and return its exit status. A SIGTERM is sent first, and if that doesn't kill the process after a few seconds a SIGKILL is sent (which it can't ignore).

If the child has already been waited the return is -1 with $! set to ECHILD (no such child).

SEE ALSO

App::Chart::Gtk2::Subprocess