(extensionId: string, vscodeCli: string, vscodeArgs: string[])
| 94 | } |
| 95 | |
| 96 | async function installExtension(extensionId: string, vscodeCli: string, vscodeArgs: string[]): Promise<void> { |
| 97 | const argsWithExtension = [...vscodeArgs, '--install-extension', extensionId]; |
| 98 | |
| 99 | // Since we're using shell execute, spaces in the CLI path will get interpeted as args |
| 100 | // Therefore we wrap the CLI path in quotes as on MacOS the path can contain spaces. |
| 101 | const cliWrapped = `"${vscodeCli}"`; |
| 102 | console.log(`${cliWrapped} ${argsWithExtension}`); |
| 103 | |
| 104 | const result = cp.spawnSync(cliWrapped, argsWithExtension, { |
| 105 | encoding: 'utf-8', |
| 106 | stdio: 'inherit', |
| 107 | // Workaround as described in https://github.com/nodejs/node/issues/52554 |
| 108 | shell: true, |
| 109 | }); |
| 110 | if (result.error || result.status !== 0) { |
| 111 | throw new Error(`Failed to install extensions: ${JSON.stringify(result)}`); |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | function getSln(workspacePath: string): string | undefined { |
| 116 | if (workspacePath.endsWith('slnWithGenerator')) { |
no test coverage detected