- 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
This commit is contained in:
Jim Wigginton 2010-11-30 04:34:31 +00:00
parent d5f788932c
commit fb0f03c904
1 changed files with 9 additions and 1 deletions

View File

@ -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);