Skip to content

Commit

Permalink
chore: update SSH command processing logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin-Stefan committed Sep 27, 2024
1 parent 55e9347 commit 2c77ba3
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,9 @@ var UqmiClient = class {
*/
async runCommand(args) {
try {
args.unshift(`--device=${this.device}`);
const escapedArgs = args.map(this.escapeShellArg).join(" ");
const stdout = await runSSHCommand(`uqmi --device=${this.device} ${escapedArgs}`, this.sshOptions);
const stdout = await runSSHCommand(`uqmi ${escapedArgs}`, this.sshOptions);
return stdout.trim();
} catch (error) {
throw new Error(`Error executing uqmi command: ${error}`);
Expand Down
3 changes: 2 additions & 1 deletion dist/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,9 @@ var UqmiClient = class {
*/
async runCommand(args) {
try {
args.unshift(`--device=${this.device}`);
const escapedArgs = args.map(this.escapeShellArg).join(" ");
const stdout = await runSSHCommand(`uqmi --device=${this.device} ${escapedArgs}`, this.sshOptions);
const stdout = await runSSHCommand(`uqmi ${escapedArgs}`, this.sshOptions);
return stdout.trim();
} catch (error) {
throw new Error(`Error executing uqmi command: ${error}`);
Expand Down
2 changes: 1 addition & 1 deletion dist/uqmiClient.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion src/uqmiClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,11 @@ export class UqmiClient {
*/
protected async runCommand(args: string[]): Promise<string> {
try {
args.unshift(`--device=${this.device}`);

// Escape all arguments before concatenating them into a single command string
const escapedArgs = args.map(this.escapeShellArg).join(" ");
const stdout = await runSSHCommand(`uqmi --device=${this.device} ${escapedArgs}`, this.sshOptions);
const stdout = await runSSHCommand(`uqmi ${escapedArgs}`, this.sshOptions);
return stdout.trim();
} catch (error) {
throw new Error(`Error executing uqmi command: ${error}`);
Expand Down

0 comments on commit 2c77ba3

Please sign in to comment.