mirror of
git://git.proxmox.com/git/pve-common.git
synced 2025-02-09 17:57:21 +03:00
run fork with timeout: only special case timeout error in list context
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>
This commit is contained in:
parent
eac8b4b872
commit
41ed439635
@ -1017,10 +1017,16 @@ sub run_fork_with_timeout {
|
||||
$res = $child_res->{result};
|
||||
$error = $child_res->{error};
|
||||
};
|
||||
|
||||
my $got_timeout = 0;
|
||||
my $wantarray = wantarray; # so it can be queried inside eval
|
||||
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->();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user