1
0
mirror of https://github.com/danog/tgseclib.git synced 2025-01-22 05:51:20 +01:00

- 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

View File

@ -1560,11 +1560,15 @@ class Net_SSH2 {
/** /**
* Execute Command * 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 String $command
* @param optional Boolean $block
* @return String * @return String
* @access public * @access public
*/ */
function exec($command) function exec($command, $block = true)
{ {
if (!($this->bitmap & NET_SSH2_MASK_LOGIN)) { if (!($this->bitmap & NET_SSH2_MASK_LOGIN)) {
return false; return false;
@ -1617,6 +1621,10 @@ class Net_SSH2 {
$this->channel_status[NET_SSH2_CHANNEL_EXEC] = NET_SSH2_MSG_CHANNEL_DATA; $this->channel_status[NET_SSH2_CHANNEL_EXEC] = NET_SSH2_MSG_CHANNEL_DATA;
if (!$block) {
return true;
}
$output = ''; $output = '';
while (true) { while (true) {
$temp = $this->_get_channel_packet(NET_SSH2_CHANNEL_EXEC); $temp = $this->_get_channel_packet(NET_SSH2_CHANNEL_EXEC);