run_with_timeout() will treat a timeout error differently when called
in list context and run_fork_with_timeout() should do the same. Ensure
this by calling run_with_timeout() in list context if and only if
run_fork_with_timeout() is called in list context too.
Fixes: a6aa0ae ("run with timeout: return if timeout happened in list context")
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
$res = $child_res->{result};
$error = $child_res->{error};
};
$res = $child_res->{result};
$error = $child_res->{error};
};
+ my $wantarray = wantarray; # so it can be queried inside eval
eval {
if (defined($timeout)) {
eval {
if (defined($timeout)) {
- (undef, $got_timeout) = run_with_timeout($timeout, $readvalues);
+ if ($wantarray) {
+ (undef, $got_timeout) = run_with_timeout($timeout, $readvalues);
+ } else {
+ run_with_timeout($timeout, $readvalues);
+ }
} else {
$readvalues->();
}
} else {
$readvalues->();
}