Blocking.pm: call abortFn if the process dies prematurely
git-svn-id: https://svn.fhem.de/fhem/trunk@15172 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
@@ -137,6 +137,11 @@ BlockingStart(;$)
|
||||
}
|
||||
if(!kill(0, $h->{pid})) {
|
||||
$h->{pid} = "DEAD:$h->{pid}";
|
||||
if(!$h->{terminated} && $h->{abortFn}) {
|
||||
no strict "refs";
|
||||
my $ret = &{$h->{abortFn}}($h->{abortArg},"Process died prematurely");
|
||||
use strict "refs";
|
||||
}
|
||||
delete($BC_hash{$bpid});
|
||||
RemoveInternalTimer($h) if($h->{timeout});
|
||||
} else {
|
||||
@@ -254,9 +259,11 @@ BlockingKill($)
|
||||
if($h->{pid} && $h->{pid} !~ m/:/ && kill(9, $h->{pid})) {
|
||||
my $ll = (defined($h->{loglevel}) ? $h->{loglevel} : 1); # Forum #77057
|
||||
Log $ll, "Timeout for $h->{fn} reached, terminated process $h->{pid}";
|
||||
$h->{terminated} = 1;
|
||||
if($h->{abortFn}) {
|
||||
no strict "refs";
|
||||
my $ret = &{$h->{abortFn}}($h->{abortArg});
|
||||
my $ret = &{$h->{abortFn}}($h->{abortArg},
|
||||
"Timeout: process terminated");
|
||||
use strict "refs";
|
||||
|
||||
} elsif($h->{finishFn}) {
|
||||
|
||||
Reference in New Issue
Block a user