Skip to content

Commit

Permalink
SSH: allow numbers to be used as arguments to ssh commands (#46)
Browse files Browse the repository at this point in the history
This PR fixes a problem preventing users from using numbers as
arguments e.g. `p0 ssh private-node sleep 10`

```
TypeError: argument.replace is not a function
    at /Users/miguelcampos/src/p0cli/dist/plugins/aws/ssm/index.js:119:18
    at Array.map (<anonymous>)
    at commandParameter (/Users/miguelcampos/src/p0cli/dist/plugins/aws/ssm/index.js:116:10)
    at /Users/miguelcampos/src/p0cli/dist/plugins/aws/ssm/index.js:141:18
    at Generator.next (<anonymous>)
    at fulfilled (/Users/miguelcampos/src/p0cli/dist/plugins/aws/ssm/index.js:5:58)
```
  • Loading branch information
GGonryun authored Feb 29, 2024
1 parent 0e545a2 commit aafd7bb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/plugins/aws/ssm/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ const commandParameter = (args: SshCommandArgs) =>
(argument) =>
// escape all double quotes (") in commands such as `p0 ssh <instance>> echo 'hello; "world"'` because we
// need to encapsulate command arguments in double quotes as we pass them along to the remote shell
`"${argument.replace(/"/g, '\\"')}"`
`"${String(argument).replace(/"/g, '\\"')}"`
)
.join(" ")}`.trim()
: undefined;
Expand Down

0 comments on commit aafd7bb

Please sign in to comment.