public interactiveWrite ( string $cmd ) : boolean | ||
$cmd | string | |
return | boolean |
function interactiveWrite($cmd)
{
if (!($this->bitmap & self::MASK_LOGIN)) {
throw new \RuntimeException('Operation disallowed prior to login()');
}
if (!($this->bitmap & self::MASK_SHELL) && !$this->_initShell()) {
throw new \RuntimeException('Unable to initiate an interactive shell session');
}
$data = pack('CNa*', NET_SSH1_CMSG_STDIN_DATA, strlen($cmd), $cmd);
if (!$this->_send_binary_packet($data)) {
throw new \RuntimeException('Error sending SSH_CMSG_STDIN');
}
return true;
}