Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Escape "-Command" arguments to prevent Terminal API failure #1772

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Escape "-Command" arguments
- Fixes: https://github.com/codercom/bugs/issues/270.
On Ubuntu 16.04 containers, the Terminal API fails to
start the pwsh executable with any "-Command" arguments.
This appears to be due to unescaped single quotes within
the argument list.
  • Loading branch information
Forest Hoffman committed Feb 22, 2019

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 6ccc7f78f155b0629b4732257e656e2769217d00
3 changes: 2 additions & 1 deletion src/process.ts
Original file line number Diff line number Diff line change
@@ -69,9 +69,10 @@ export class PowerShellProcess {
powerShellArgs.push("-ExecutionPolicy", "Bypass");
}

this.startArgs = this.startArgs.replace(/'/g, '"');
powerShellArgs.push(
"-Command",
"& '" + PowerShellProcess.escapeSingleQuotes(startScriptPath) + "' " + this.startArgs);
"'& \"" + PowerShellProcess.escapeSingleQuotes(startScriptPath) + "\" " + this.startArgs + "'");

let powerShellExePath = this.exePath;