From eac8b4b872e4176497e1d9e4aa28d26383287e9f Mon Sep 17 00:00:00 2001 From: Fiona Ebner Date: Wed, 30 Aug 2023 15:07:51 +0200 Subject: [PATCH] run with timeout: only special-case timeout error in list-context and not other errors too. Fixes: a6aa0ae ("run with timeout: return if timeout happened in list context") Signed-off-by: Fiona Ebner --- src/PVE/Tools.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/PVE/Tools.pm b/src/PVE/Tools.pm index 50240c8..724fb69 100644 --- a/src/PVE/Tools.pm +++ b/src/PVE/Tools.pm @@ -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; } -- 2.39.2