Skip to content
This repository has been archived by the owner on May 30, 2024. It is now read-only.

Commit

Permalink
Avoid single quotes in commands when shell is not defined
Browse files Browse the repository at this point in the history
  • Loading branch information
vinistock committed Jul 21, 2023
1 parent 3456bc0 commit c098715
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/ruby.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,12 @@ export class Ruby {
}

private async activate(ruby: string) {
let command = this.shell ? `${this.shell} -ic ` : "";
command += `'${ruby} -rjson -e "printf(%{RUBY_ENV_ACTIVATE%sRUBY_ENV_ACTIVATE}, JSON.dump(ENV.to_h))"'`;
let command = this.shell ? `${this.shell} -ic '` : "";
command += `${ruby} -rjson -e "printf(%{RUBY_ENV_ACTIVATE%sRUBY_ENV_ACTIVATE}, JSON.dump(ENV.to_h))"`;

if (this.shell) {
command += "'";
}

const result = await asyncExec(command, { cwd: this.workingFolder });

Expand Down Expand Up @@ -276,8 +280,13 @@ export class Ruby {

private async toolExists(tool: string) {
try {
let command = this.shell ? `${this.shell} -ic ` : "";
command += `'${tool} --version'`;
let command = this.shell ? `${this.shell} -ic '` : "";
command += `${tool} --version`;

if (this.shell) {
command += "'";
}

await asyncExec(command, { cwd: this.workingFolder });
return true;
} catch {
Expand Down

0 comments on commit c098715

Please sign in to comment.