diff options
| author | Shreya Keshive <[email protected]> | 2025-08-19 13:25:11 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-08-19 20:25:11 +0000 |
| commit | ed1fc4ddb39a25fad2c9dd12a250959c050a6343 (patch) | |
| tree | 1ff5fdcf8edbaaed52d4b13f107c3d7dee251b1b /packages/core/src/ide/ide-installer.ts | |
| parent | 24858b319a81aa4293ffebd8573b6d38c428fec5 (diff) | |
fix(ide): Fix bug where companion extension was not being installed on Windows correctly (#6576)
Diffstat (limited to 'packages/core/src/ide/ide-installer.ts')
| -rw-r--r-- | packages/core/src/ide/ide-installer.ts | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/packages/core/src/ide/ide-installer.ts b/packages/core/src/ide/ide-installer.ts index 4a771c67..bf74bd07 100644 --- a/packages/core/src/ide/ide-installer.ts +++ b/packages/core/src/ide/ide-installer.ts @@ -26,13 +26,22 @@ export interface InstallResult { async function findVsCodeCommand(): Promise<string | null> { // 1. Check PATH first. try { - child_process.execSync( - process.platform === 'win32' - ? `where.exe ${VSCODE_COMMAND}` - : `command -v ${VSCODE_COMMAND}`, - { stdio: 'ignore' }, - ); - return VSCODE_COMMAND; + if (process.platform === 'win32') { + const result = child_process + .execSync(`where.exe ${VSCODE_COMMAND}`) + .toString() + .trim(); + // `where.exe` can return multiple paths. Return the first one. + const firstPath = result.split(/\r?\n/)[0]; + if (firstPath) { + return firstPath; + } + } else { + child_process.execSync(`command -v ${VSCODE_COMMAND}`, { + stdio: 'ignore', + }); + return VSCODE_COMMAND; + } } catch { // Not in PATH, continue to check common locations. } |
