diff --git a/src/Ssh/Exec.php b/src/Ssh/Exec.php index f951d37..1347427 100644 --- a/src/Ssh/Exec.php +++ b/src/Ssh/Exec.php @@ -28,6 +28,7 @@ public function run($cmd, $pty = null, array $env = array(), $width = 80, $heigh $output = stream_get_contents($stdout); preg_match('/\[return_code:(.*?)\]/', $output, $match); + $match[1] = isset($match[1]) ? $match[1] : 1; if ((int) $match[1] !== 0) { throw new RuntimeException(stream_get_contents($stderr), (int) $match[1]); }