diff --git a/.changesets/10663.md b/.changesets/10663.md new file mode 100644 index 000000000000..3173cf56cb10 --- /dev/null +++ b/.changesets/10663.md @@ -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. + diff --git a/packages/cli/src/commands/deploy/baremetal/SshExecutor.js b/packages/cli/src/commands/deploy/baremetal/SshExecutor.js index 4978a930dbf3..aa1090848cdb 100644 --- a/packages/cli/src/commands/deploy/baremetal/SshExecutor.js +++ b/packages/cli/src/commands/deploy/baremetal/SshExecutor.js @@ -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}`, ) } @@ -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