Skip to content

Commit

Permalink
fix(cli): Handle case for no arguments for verbose baremetal deploy (#…
Browse files Browse the repository at this point in the history
…10663)

**Problem**
We recently improved the verbose output of the baremetal deployment
process. It looks like this improvement has introduced a small bug. See
#10654 for more details.

**Changes**
1. Guard against `args` being undefined.

---------

Co-authored-by: Tobbe Lundberg <tobbe@tlundberg.com>
  • Loading branch information
Josh-Walker-GM and Tobbe committed May 22, 2024
1 parent 2008910 commit a3a8749
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
4 changes: 4 additions & 0 deletions .changesets/10663.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- fix(cli): Handle case for no arguments for verbose baremetal deploy (#10663) by @Josh-Walker-GM

The change corrects a bug during baremetal deployments when using the `--verbose` flag. See #10654 for more details.

11 changes: 4 additions & 7 deletions packages/cli/src/commands/deploy/baremetal/SshExecutor.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,12 @@ export class SshExecutor {
* the exit code with the same code returned from the SSH command.
*/
async exec(path, command, args) {
let sshCommand = command

if (args) {
sshCommand += ` ${args.join(' ')}`
}
const argsString = args?.join(' ') || ''
const sshCommand = command + argsString

if (this.verbose) {
console.log(
`SshExecutor::exec running command \`${command} ${args.join(' ')}\` in ${path}`,
`SshExecutor::exec running command \`${sshCommand}\` in ${path}`,
)
}

Expand All @@ -28,7 +25,7 @@ export class SshExecutor {

if (result.code !== 0) {
const error = new Error(
`Error while running command \`${command} ${args.join(' ')}\` in ${path}\n` +
`Error while running command \`${sshCommand}\` in ${path}\n` +
result.stderr,
)
error.exitCode = result.code
Expand Down

0 comments on commit a3a8749

Please sign in to comment.