本文整理汇总了PHP中Net_SSH2::getStdError方法的典型用法代码示例。如果您正苦于以下问题:PHP Net_SSH2::getStdError方法的具体用法?PHP Net_SSH2::getStdError怎么用?PHP Net_SSH2::getStdError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Net_SSH2
的用法示例。
在下文中一共展示了Net_SSH2::getStdError方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deploy
public function deploy()
{
$releaseId = $this->dataBase->startRelease();
$ssh = new Net_SSH2(SSH_SERVER);
$key = new Crypt_RSA();
$key->setPassword(SSH_PASSWORD);
$key->loadKey(file_get_contents(PATH_TO_PRIVATE_KEY));
if (!$ssh->login(SSH_LOGIN, $key)) {
$this->dataBase->logStep($releaseId, 'ssh ' . SSH_SERVER, ['error' => 'Login failed'], 1);
exit('Login Failed');
}
$ssh->enableQuietMode();
$command = $this->bash->dtLock('sandbox-mercury', 'mercury');
$output['success'] = $ssh->exec($command);
$output['error'] = $ssh->getStdError();
$this->dataBase->logStep($releaseId, $command, $output, $ssh->getExitStatus());
$command = $this->bash->dtPrep('sandbox-mercury', 'mercury', ["mercury" => "dev"]);
$output['success'] = $ssh->exec($command);
$output['error'] = $ssh->getStdError();
$this->dataBase->logStep($releaseId, $command, $output, $ssh->getExitStatus());
$command = $this->bash->dtPush('sandbox-mercury', 'mercury');
$output['success'] = $ssh->exec($command);
$output['error'] = $ssh->getStdError();
$this->dataBase->logStep($releaseId, $command, $output, $ssh->getExitStatus());
}
示例2: run
/**
* @param $command
*
* @throws \RuntimeException
* @throws \Jumper\Exception\CommunicatorException
* @return String
*/
public function run($command)
{
$result = $this->ssh->exec($command);
if ($result === false) {
throw new CommunicatorException($this->ssh->getLastError());
}
$error = $this->ssh->getStdError();
if (!empty($error)) {
throw new \RuntimeException($error);
}
return $result;
}