From 526bb761169a06eb9170f970da010ab02f0dc85f Mon Sep 17 00:00:00 2001 From: Zane Hooper Date: Tue, 14 Jul 2015 19:01:20 -0400 Subject: [PATCH] Fix empty stdout --- src/Ssh/Exec.php | 1 + 1 file changed, 1 insertion(+) 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]); }