From fb0f03c9043449028e0234527ab0c48ad4bfac2f Mon Sep 17 00:00:00 2001 From: Jim Wigginton Date: Tue, 30 Nov 2010 04:34:31 +0000 Subject: [PATCH] - added $block parameter to Net_SSH2::exec() (thanks jl_ewing!) git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@135 21d32557-59b3-4da0-833f-c5933fad653e --- phpseclib/Net/SSH2.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/phpseclib/Net/SSH2.php b/phpseclib/Net/SSH2.php index 263f347b..0854d495 100644 --- a/phpseclib/Net/SSH2.php +++ b/phpseclib/Net/SSH2.php @@ -1560,11 +1560,15 @@ class Net_SSH2 { /** * Execute Command * + * If $block is set to false then Net_SSH2::_get_channel_packet(NET_SSH2_CHANNEL_EXEC) will need to be called manually. + * In all likelihood, this is not a feature you want to be taking advantage of. + * * @param String $command + * @param optional Boolean $block * @return String * @access public */ - function exec($command) + function exec($command, $block = true) { if (!($this->bitmap & NET_SSH2_MASK_LOGIN)) { return false; @@ -1617,6 +1621,10 @@ class Net_SSH2 { $this->channel_status[NET_SSH2_CHANNEL_EXEC] = NET_SSH2_MSG_CHANNEL_DATA; + if (!$block) { + return true; + } + $output = ''; while (true) { $temp = $this->_get_channel_packet(NET_SSH2_CHANNEL_EXEC);