From b45e2dc0f9b6f883e7da11ec228bdb7394131c85 Mon Sep 17 00:00:00 2001 From: Tom Rochette Date: Wed, 4 Mar 2015 15:22:45 -0500 Subject: [PATCH] Return $result if getStdError() returns an empty string. This is done to support applications which return a non-zero exit status but do not output error messages to stderr. --- src/Server/Remote/PhpSecLib.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Server/Remote/PhpSecLib.php b/src/Server/Remote/PhpSecLib.php index d3e9a3ec..b56f053b 100644 --- a/src/Server/Remote/PhpSecLib.php +++ b/src/Server/Remote/PhpSecLib.php @@ -74,12 +74,12 @@ class PhpSecLib implements ServerInterface break; case Configuration::AUTH_BY_AGENT: - + $key = new Agent(); $result = $this->sftp->login($serverConfig->getUser(), $key); - + break; - + default: throw new RuntimeException('You need to specify authentication method.'); } @@ -109,7 +109,8 @@ class PhpSecLib implements ServerInterface $result = $this->sftp->exec($command); if ($this->sftp->getExitStatus() !== 0) { - throw new \RuntimeException($this->sftp->getStdError()); + $output = $this->sftp->getStdError() ?: $result; + throw new \RuntimeException($output); } return $result;