Skip to content

Commit

Permalink
fix: wrap mustRun to catch errors
Browse files Browse the repository at this point in the history
  • Loading branch information
tobybellwood committed Aug 14, 2023
1 parent ac4d054 commit 0cc3076
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/LagoonCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public function getJwtToken() {
$args += ["-i", $this->sshKey];
}

$cmd = ["ssh", ...$args, "lagoon@$ssh_host", "token", "2>&1"];
$cmd = ["ssh", ...$args, "lagoon@$ssh_host", "token"];

$this->logger()->debug("Retrieving token via SSH -" . implode(" ", $cmd));
if (version_compare(Kernel::VERSION, "4.2", "<")) {
Expand All @@ -209,7 +209,12 @@ public function getJwtToken() {
}

$ssh->setTimeout($this->sshTimeout);
$ssh->mustRun();

try {
$ssh->mustRun();
} catch (ProcessFailedException $exception) {
$this->logger->debug($ssh->getMessage());
}

$token = trim($ssh->getOutput());
$this->logger->debug("JWT Token loaded via ssh: " . $token);
Expand Down

0 comments on commit 0cc3076

Please sign in to comment.