mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-12-28 12:10:59 +00:00
added getStdError method to get stdErr, even when quiet mode enabled
This commit is contained in:
parent
11a6b1a1af
commit
cc8e3cdbc1
@ -732,6 +732,12 @@ class Net_SSH2 {
|
||||
*/
|
||||
var $in_request_pty_exec = false;
|
||||
|
||||
/**
|
||||
* Contents of stdError
|
||||
* @access private
|
||||
*/
|
||||
var $stdErrorLog;
|
||||
|
||||
/**
|
||||
* Default Constructor.
|
||||
*
|
||||
@ -1789,6 +1795,13 @@ class Net_SSH2 {
|
||||
$this->timeout = $this->curTimeout = $timeout;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the output from stdError
|
||||
*/
|
||||
function getStdError(){
|
||||
return $this->stdErrorLog;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute Command
|
||||
*
|
||||
@ -1803,6 +1816,7 @@ class Net_SSH2 {
|
||||
function exec($command, $block = true)
|
||||
{
|
||||
$this->curTimeout = $this->timeout;
|
||||
$this->stdErrorLog = '';
|
||||
|
||||
if (!($this->bitmap & NET_SSH2_MASK_LOGIN)) {
|
||||
return false;
|
||||
@ -2395,9 +2409,6 @@ class Net_SSH2 {
|
||||
$this->channel_buffers[$client_channel][] = $data;
|
||||
break;
|
||||
case NET_SSH2_MSG_CHANNEL_EXTENDED_DATA:
|
||||
if ($skip_extended || $this->quiet_mode) {
|
||||
break;
|
||||
}
|
||||
/*
|
||||
if ($client_channel == NET_SSH2_CHANNEL_EXEC) {
|
||||
$this->_send_channel_packet($client_channel, chr(0));
|
||||
@ -2406,6 +2417,10 @@ class Net_SSH2 {
|
||||
// currently, there's only one possible value for $data_type_code: NET_SSH2_EXTENDED_DATA_STDERR
|
||||
extract(unpack('Ndata_type_code/Nlength', $this->_string_shift($response, 8)));
|
||||
$data = $this->_string_shift($response, $length);
|
||||
$this->stdErrorLog .= $data;
|
||||
if ($skip_extended || $this->quiet_mode) {
|
||||
break;
|
||||
}
|
||||
if ($client_channel == $channel) {
|
||||
return $data;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user