Skip to content

Commit 33268c2

Browse files
committed
Fix install extensions launch on MacOS
1 parent e4c3008 commit 33268c2

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

test/vscodeLauncher.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,26 @@ function getSln(workspacePath: string): string | undefined {
1717

1818
async function main() {
1919
try {
20-
const vscodeExecutablePath = await downloadAndUnzipVSCode('1.92.2');
20+
const vscodeExecutablePath = await downloadAndUnzipVSCode('stable');
2121
const [cli, ...args] = resolveCliArgsFromVSCodeExecutablePath(vscodeExecutablePath);
2222

2323
console.log('Display: ' + process.env.DISPLAY);
2424

2525
const fullArgs = [...args, '--install-extension', 'ms-dotnettools.vscode-dotnet-runtime'];
26-
console.log(fullArgs);
27-
const result = cp.spawnSync(cli, fullArgs, {
26+
27+
// Since we're using shell execute, spaces in the CLI path will get interpeted as args
28+
// Therefore we wrap the CLI path in quotes as on MacOS the path can contain spaces.
29+
const cliWrapped = `"${cli}"`;
30+
console.log(`${cliWrapped} ${fullArgs}`);
31+
32+
const result = cp.spawnSync(cliWrapped, fullArgs, {
2833
encoding: 'utf-8',
2934
stdio: 'inherit',
3035
// Workaround as described in https://github.com/nodejs/node/issues/52554
3136
shell: true,
3237
});
33-
if (result.error) {
34-
throw new Error(`Failed to install the runtime extension: ${result.error}`);
38+
if (result.error || result.status !== 0) {
39+
throw new Error(`Failed to install the runtime extension: ${JSON.stringify(result)}`);
3540
}
3641

3742
// The folder containing the Extension Manifest package.json

0 commit comments

Comments
 (0)