]> git.proxmox.com Git - pve-common.git/commitdiff
run with timeout: only special-case timeout error in list-context
authorFiona Ebner <f.ebner@proxmox.com>
Wed, 30 Aug 2023 13:07:51 +0000 (15:07 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 30 Aug 2023 14:44:40 +0000 (16:44 +0200)
and not other errors too.

Fixes: a6aa0ae ("run with timeout: return if timeout happened in list context")
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
src/PVE/Tools.pm

index 50240c8fc34df12a1ea9bb0bac1093bd54721b03..724fb696b2c7c78a7dd4168ca9914a4bf2573683 100644 (file)
@@ -143,7 +143,8 @@ sub run_with_timeout {
     # this shouldn't happen anymore?
     die "unknown error" if $sigcount && !$err; # seems to happen sometimes
 
-    die $err if $err && !wantarray; # assume that user handles timeout err if called in list context
+    # assume that user handles timeout err if called in list context
+    die $err if $err && (!wantarray || !$got_timeout);
 
     return wantarray ? ($res, $got_timeout) : $res;
 }