Merge pull request #727 from rlacerda83/ssh2_pty_option

Add pty option for ssh2 connection
This commit is contained in:
Anton Medvedev 2016-08-04 22:44:57 +04:00 committed by GitHub
commit 4a90311244
3 changed files with 43 additions and 1 deletions

View File

@ -255,4 +255,17 @@ class Builder
is_object($password) ? get_class($password) : gettype($password) is_object($password) ? get_class($password) : gettype($password)
)); ));
} }
/**
* Use pty in ssh2 connection
*
* @param $ssh2Pty
* @return $this
*/
public function ssh2Pty($ssh2Pty)
{
$this->config->setSsh2Pty($ssh2Pty);
return $this;
}
} }

View File

@ -101,6 +101,14 @@ class Configuration
*/ */
private $pemFile; private $pemFile;
/**
* Pty configuration for ssh2 connection
*
* @var mixed
*/
private $ssh2Pty = null;
/** /**
* Construct * Construct
* *
@ -412,4 +420,24 @@ class Configuration
return $password; return $password;
} }
/**
* Set pty for ssh2 connection
*
* @param $ssh2Pty
*/
public function setSsh2Pty($ssh2Pty)
{
$this->ssh2Pty = $ssh2Pty;
}
/**
* Get pty option for ssh2 connection
*
* @return mixed
*/
public function getSsh2Pty()
{
return $this->ssh2Pty;
}
} }

View File

@ -113,7 +113,8 @@ class SshExtension implements ServerInterface
{ {
$this->checkConnection(); $this->checkConnection();
return $this->session->getExec()->run($command); $pty = $this->getConfiguration()->getSsh2Pty();
return $this->session->getExec()->run($command, $pty);
} }
/** /**