From 20e7131b2dda5e951aa612a37e3ca2d84645ff42 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ren=C3=A9=20Jochum?= Date: Wed, 20 Jun 2018 11:46:55 +0200 Subject: [PATCH 1/1] Handle errors on tasks correctly with a die, MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit so we get the correct exit code on errors. Signed-off-by: René Jochum --- PVE/APIClient/Helpers.pm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/PVE/APIClient/Helpers.pm b/PVE/APIClient/Helpers.pm index 7d855ec..5c2e4cb 100644 --- a/PVE/APIClient/Helpers.pm +++ b/PVE/APIClient/Helpers.pm @@ -355,6 +355,10 @@ sub poll_task { sleep(2); } + if ($task_status->{exitstatus} ne "OK") { + die $task_status->{exitstatus}; + } + return $task_status->{exitstatus}; } -- 2.39.2