From aafd7bbd3708c547c42916a4ab857033b9fdb988 Mon Sep 17 00:00:00 2001 From: Miguel Campos Date: Wed, 28 Feb 2024 16:45:03 -0800 Subject: [PATCH] SSH: allow numbers to be used as arguments to ssh commands (#46) 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 () 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 () at fulfilled (/Users/miguelcampos/src/p0cli/dist/plugins/aws/ssm/index.js:5:58) ``` --- src/plugins/aws/ssm/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/aws/ssm/index.ts b/src/plugins/aws/ssm/index.ts index fdb677a..aa69ae2 100644 --- a/src/plugins/aws/ssm/index.ts +++ b/src/plugins/aws/ssm/index.ts @@ -184,7 +184,7 @@ const commandParameter = (args: SshCommandArgs) => (argument) => // escape all double quotes (") in commands such as `p0 ssh > 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;