mirror of
https://github.com/danog/phpseclib.git
synced 2024-12-03 18:18:05 +01:00
Extract the exit_status if given to us from SSH.
This commit is contained in:
parent
ce22f11f7f
commit
efdec7b118
@ -709,6 +709,14 @@ class Net_SSH2 {
|
|||||||
*/
|
*/
|
||||||
var $last_packet;
|
var $last_packet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exit status returned from ssh if any
|
||||||
|
*
|
||||||
|
* @var Integer
|
||||||
|
* @access private
|
||||||
|
*/
|
||||||
|
var $exit_status;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default Constructor.
|
* Default Constructor.
|
||||||
*
|
*
|
||||||
@ -2330,6 +2338,8 @@ class Net_SSH2 {
|
|||||||
$this->errors[count($this->errors)].= "\r\n" . $this->_string_shift($response, $length);
|
$this->errors[count($this->errors)].= "\r\n" . $this->_string_shift($response, $length);
|
||||||
}
|
}
|
||||||
case 'exit-status':
|
case 'exit-status':
|
||||||
|
extract(unpack('Cfalse/Nexit_status', $this->_string_shift($response, 5)));
|
||||||
|
$this->exit_status = $exit_status;
|
||||||
// "The channel needs to be closed with SSH_MSG_CHANNEL_CLOSE after this message."
|
// "The channel needs to be closed with SSH_MSG_CHANNEL_CLOSE after this message."
|
||||||
// -- http://tools.ietf.org/html/rfc4254#section-6.10
|
// -- http://tools.ietf.org/html/rfc4254#section-6.10
|
||||||
$this->_send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_EOF, $this->server_channels[$client_channel]));
|
$this->_send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_EOF, $this->server_channels[$client_channel]));
|
||||||
@ -2973,4 +2983,18 @@ class Net_SSH2 {
|
|||||||
|
|
||||||
return $this->signature_format . ' ' . base64_encode($this->server_public_host_key);
|
return $this->signature_format . ' ' . base64_encode($this->server_public_host_key);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
|
* Returns the exit status of an SSH command or false.
|
||||||
|
*
|
||||||
|
* @return Integer or false
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
function getExitStatus()
|
||||||
|
{
|
||||||
|
if (is_null($this->exit_status)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return $this->exit_status;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user