I am using poco-generic to spawn a long running child. The child executes a
series of test steps and then exits when it is finished.  I'm running into a
problem with attempting to stop/kill the long running child under the
following condition.

Condition:
Child process connects to another device (Net::OpenSSH) and executes some
commands, including some long sleeps on occasion.  For some reason, if I try
to do the following:   $heap->{$alias}->shutdown();
While the sleep is active, the spawned child is not killed/doesn't shutdown
successfully.

Is there another better way to do this:

(Main POE session)
if($current) {
 $kernel->sig_child($heap->{$current}->{child_PID}, "sig_child");
}

(sig_child sub)
sub sig_child {
my ($heap, $sig, $pid, $exit_val) = @_[HEAP, ARG0, ARG1, ARG2];
 my $alias = $heap->{current_alias};
        # $heap->{$alias} is a reference to the spawned poco-generic process
if(defined $heap->{$alias}){
$heap->{$alias}->shutdown();
my $deleted = delete($heap->{$alias});
}
if(defined $heap->{$pid}){
my $details = delete $heap->{$pid};
}
 warn "$$: Child $pid exited";
}

Reply via email to