Ejemplo n.º 1
0
 /**
  * Typically called from Connection::execute()
  *
  * @param string     $command
  * @param Connection $connection
  * @param Terminal   $terminal
  * @param string     $pty
  */
 function __construct($command, Connection $connection, Terminal $terminal, $pty = null)
 {
     $this->command = $command;
     $this->connection = $connection;
     $this->terminal = $terminal;
     if (!$connection->isConnected()) {
         throw new NotConnectedException();
     }
     if (!$connection->isAuthenticated()) {
         throw new NotAuthenticatedException();
     }
     $this->resource = ssh2_exec($connection->getResource(), $command, $pty, $terminal->getEnv(), $terminal->getWidth(), $terminal->getHeight(), $terminal->getDimensionUnitType());
 }
Ejemplo n.º 2
0
Archivo: Shell.php Proyecto: bravo3/ssh
 /**
  * Typically called from Connection::getShell()
  *
  * @param Connection $connection
  * @param Terminal   $terminal
  */
 function __construct(Connection $connection, Terminal $terminal)
 {
     if (!$connection->isConnected()) {
         throw new NotConnectedException();
     }
     if (!$connection->isAuthenticated()) {
         throw new NotAuthenticatedException();
     }
     $this->shell_type = null;
     $this->connection = $connection;
     $this->terminal = $terminal;
     $this->resource = ssh2_shell($connection->getResource(), $terminal->getTerminalType(), $terminal->getEnv(), $terminal->getWidth(), $terminal->getHeight(), $terminal->getDimensionUnitType());
 }
Ejemplo n.º 3
0
 /**
  * @small
  */
 public function testProperties()
 {
     $terminal = new Terminal();
     $this->assertEquals(TerminalType::XTERM, $terminal->getTerminalType());
     $this->assertEquals(TerminalUnit::CHARACTERS, $terminal->getDimensionUnitType());
 }