Skip to content

Commit bb90ced

Browse files
authored
Fix global flags escaping when starting a workspace using the CLI (#592)
Closes #591
1 parent bd09ae6 commit bb90ced

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/api/workspace.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { Workspace } from "coder/site/src/api/typesGenerated";
44
import * as vscode from "vscode";
55
import { FeatureSet } from "../featureSet";
66
import { getGlobalFlags } from "../globalFlags";
7+
import { escapeCommandArg } from "../util";
78
import { errToStr, createWorkspaceIdentifier } from "./api-helper";
89
import { CoderApi } from "./coderApi";
910

@@ -36,7 +37,9 @@ export async function startWorkspaceIfStoppedOrFailed(
3637
startArgs.push(...["--reason", "vscode_connection"]);
3738
}
3839

39-
const startProcess = spawn(binPath, startArgs, { shell: true });
40+
// { shell: true } requires one shell-safe command string, otherwise we lose all escaping
41+
const cmd = `${escapeCommandArg(binPath)} ${startArgs.join(" ")}`;
42+
const startProcess = spawn(cmd, { shell: true });
4043

4144
startProcess.stdout.on("data", (data: Buffer) => {
4245
data

0 commit comments

Comments
 (0)