From 5f220a74783a40b061c394d795bb7d222fc95b83 Mon Sep 17 00:00:00 2001 From: Sven Slootweg Date: Sun, 29 Apr 2012 07:07:30 +0200 Subject: [PATCH] Exit code handling --- frontend/classes/class.sshconnector.php | 5 +++++ runhelper/runhelper | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/frontend/classes/class.sshconnector.php b/frontend/classes/class.sshconnector.php index 8d587bc..da38445 100644 --- a/frontend/classes/class.sshconnector.php +++ b/frontend/classes/class.sshconnector.php @@ -103,6 +103,11 @@ class SshConnector extends CPHPBaseClass fclose($stream); + if($returndata->returncode != 0 && $throw_exception === true) + { + throw new SshExitException("Non-zero exit code returned: {$returndata->stderr}", $returndata->returncode); + } + return $returndata; } } diff --git a/runhelper/runhelper b/runhelper/runhelper index ba3b1cc..8a78b19 100644 --- a/runhelper/runhelper +++ b/runhelper/runhelper @@ -13,7 +13,7 @@ pr.wait() obj = { 'stdout': data[0], 'stderr': data[1], - 'return': pr.returncode + 'returncode': pr.returncode } print json.dumps(obj)