diff --git a/composer.json b/composer.json index 1bda6a3..374348d 100755 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "laravelcollective/remote", + "name": "whitecube/remote", "description": "Remote SSH access for The Laravel Framework.", "license": "MIT", "homepage": "http://laravelcollective.com", @@ -19,12 +19,12 @@ ], "require": { "php": ">=7.2", - "illuminate/support": "^6.0|^7.0|^8.0", - "illuminate/filesystem": "^6.0|^7.0|^8.0", - "phpseclib/phpseclib": "^2.0" + "illuminate/support": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0", + "illuminate/filesystem": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0", + "phpseclib/phpseclib": "^3.0" }, "require-dev": { - "illuminate/console": "^6.0|^7.0|^8.0", + "illuminate/console": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0", "mockery/mockery": "~1.0", "phpunit/phpunit": "~5.5" }, diff --git a/src/Connection.php b/src/Connection.php index d6afd85..d0cb73f 100755 --- a/src/Connection.php +++ b/src/Connection.php @@ -119,20 +119,9 @@ public function run($commands, Closure $callback = null, int $timeout = null) $gateway->setTimeout($timeout); } - $callback = $this->getCallback($callback); + $result = $gateway->run($this->formatCommands($commands)); - $gateway->run($this->formatCommands($commands)); - - // After running the commands against the server, we will continue to ask for - // the next line of output that is available, and write it them out using - // our callback. Once we hit the end of output, we'll bail out of here. - while (true) { - if (is_null($line = $gateway->nextLine())) { - break; - } - - call_user_func($callback, $line, $this); - } + call_user_func($this->getCallback($callback), $result); } /** diff --git a/src/SecLibGateway.php b/src/SecLibGateway.php index d25a044..d0f3c8f 100755 --- a/src/SecLibGateway.php +++ b/src/SecLibGateway.php @@ -2,12 +2,12 @@ namespace Collective\Remote; -use phpseclib\Net\SFTP; -use phpseclib\Net\SSH2; -use phpseclib\Crypt\RSA; +use phpseclib3\Net\SFTP; +use phpseclib3\Net\SSH2; +use phpseclib3\Crypt\RSA; use Illuminate\Support\Arr; use Illuminate\Support\Str; -use phpseclib\System\SSH\Agent; +use phpseclib3\System\SSH\Agent; use Illuminate\Filesystem\Filesystem; class SecLibGateway implements GatewayInterface @@ -280,11 +280,11 @@ public function connected() * * @param string $command * - * @return void + * @return string|bool */ public function run($command) { - $this->getConnection()->exec($command, false); + return $this->getConnection()->exec($command, null); } /** @@ -382,9 +382,7 @@ public function delete($remote) */ public function nextLine() { - $value = $this->getConnection()->_get_channel_packet(SSH2::CHANNEL_EXEC); - - return $value === true ? null : $value; + return null; } /**