Throw an Exception if the runhelper is not installed on a node

feature/node-rewrite
Sven Slootweg 12 years ago
parent 1ce94b94dc
commit 17ad3d6429

@ -105,13 +105,25 @@ class SshConnector extends CPHPBaseClass
$command = "{$this->helper} {$command}";
$stream = ssh2_exec($this->connection, $command);
$error_stream = ssh2_fetch_stream($stream, SSH2_STREAM_STDERR);
stream_set_blocking($stream, true);
stream_set_blocking($error_stream, true);
$result = stream_get_contents($stream);
$error = stream_get_contents($error_stream);
if(strpos($error, "No such file or directory") !== false)
{
throw new Exception("The runhelper is not installed on the node.");
}
$returndata = json_decode(stream_get_contents($stream));
$returndata = json_decode($result);
$returndata->stderr = trim($returndata->stderr);
fclose($stream);
fclose($error_stream);
if($returndata->returncode != 0 && $throw_exception === true)
{

Loading…
Cancel
Save