From 4d347205a39376b45d166fce56b0c556b6e0e811 Mon Sep 17 00:00:00 2001 From: Fabian Blechschmidt Date: Mon, 17 Oct 2016 23:57:39 +0200 Subject: [PATCH] Add last output to Exec I have currently the problem, that the connection doesn't use forwardAgent for the connection from staging to bitbucket, which is hard to debug. If I would just get the last output which says "No permission" I would have saved an hour. --- src/Ssh/Exec.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Ssh/Exec.php b/src/Ssh/Exec.php index f951d37..8b73478 100644 --- a/src/Ssh/Exec.php +++ b/src/Ssh/Exec.php @@ -29,7 +29,7 @@ public function run($cmd, $pty = null, array $env = array(), $width = 80, $heigh $output = stream_get_contents($stdout); preg_match('/\[return_code:(.*?)\]/', $output, $match); if ((int) $match[1] !== 0) { - throw new RuntimeException(stream_get_contents($stderr), (int) $match[1]); + throw new RuntimeException(stream_get_contents($stderr) . "\nLast output: " . $output, (int) $match[1]); } return preg_replace('/\[return_code:(.*?)\]/', '', $output);