From ed1fc4ddb39a25fad2c9dd12a250959c050a6343 Mon Sep 17 00:00:00 2001 From: Shreya Keshive Date: Tue, 19 Aug 2025 13:25:11 -0700 Subject: fix(ide): Fix bug where companion extension was not being installed on Windows correctly (#6576) --- packages/core/src/ide/ide-installer.ts | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'packages/core/src/ide/ide-installer.ts') 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 { // 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. } -- cgit v1.2.3