Skip to content

Commit 00c06c3

Browse files
committed
Fix Windows command execution by properly escaping paths and redirecting stderr to stdout
1 parent 0865c4d commit 00c06c3

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

client/src/setupCommands.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,16 @@ export function setupCommands(context: ExtensionContext) {
5050
let path = state.selectedVersion.path;
5151
if (process.platform === "win32") {
5252
// on windows we need to escape spaces
53-
path = `& "${path}" 2>&1 | Out-String `;
53+
path = `& "${path}"`;
5454
}
5555

56-
// Send the command to the terminal
57-
terminal.sendText(
58-
`${path} cli --sketch="${dirname(resource.fsPath)}" --run `,
59-
true
60-
);
56+
let cmd = `${path} --sketch="${dirname(resource.fsPath)}" --run`;
57+
if (process.platform === "win32") {
58+
// on windows we need to pipe stderr to stdout and convert to string
59+
cmd += `2>&1 | Out-String`;
60+
}
61+
62+
terminal.sendText(cmd, true);
6163
});
6264

6365
const stopSketch = commands.registerCommand('processing.sketch.stop', () => {

0 commit comments

Comments
 (0)