Skip to content

Commit a3a8749

Browse files
Josh-Walker-GMTobbe
andcommitted
fix(cli): Handle case for no arguments for verbose baremetal deploy (#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 <[email protected]>
1 parent 2008910 commit a3a8749

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

.changesets/10663.md

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
- fix(cli): Handle case for no arguments for verbose baremetal deploy (#10663) by @Josh-Walker-GM
2+
3+
The change corrects a bug during baremetal deployments when using the `--verbose` flag. See #10654 for more details.
4+

packages/cli/src/commands/deploy/baremetal/SshExecutor.js

+4-7
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,12 @@ export class SshExecutor {
1010
* the exit code with the same code returned from the SSH command.
1111
*/
1212
async exec(path, command, args) {
13-
let sshCommand = command
14-
15-
if (args) {
16-
sshCommand += ` ${args.join(' ')}`
17-
}
13+
const argsString = args?.join(' ') || ''
14+
const sshCommand = command + argsString
1815

1916
if (this.verbose) {
2017
console.log(
21-
`SshExecutor::exec running command \`${command} ${args.join(' ')}\` in ${path}`,
18+
`SshExecutor::exec running command \`${sshCommand}\` in ${path}`,
2219
)
2320
}
2421

@@ -28,7 +25,7 @@ export class SshExecutor {
2825

2926
if (result.code !== 0) {
3027
const error = new Error(
31-
`Error while running command \`${command} ${args.join(' ')}\` in ${path}\n` +
28+
`Error while running command \`${sshCommand}\` in ${path}\n` +
3229
result.stderr,
3330
)
3431
error.exitCode = result.code

0 commit comments

Comments
 (0)