diff --git a/src/main/startup/hydrate-shell-path.test.ts b/src/main/startup/hydrate-shell-path.test.ts index 9fc3c96581a..97ac2c3b4cb 100644 --- a/src/main/startup/hydrate-shell-path.test.ts +++ b/src/main/startup/hydrate-shell-path.test.ts @@ -40,6 +40,7 @@ describe('hydrateShellPath', () => { }) afterEach(() => { + vi.restoreAllMocks() if (originalPath === undefined) { delete process.env.PATH } else { @@ -180,6 +181,9 @@ describe('hydrateShellPath', () => { }) it('probes with the recorded launch PATH so seeded fallbacks cannot pin nvm', async () => { + // Why: shellProbeEnv short-circuits on win32, so pin the platform or this + // POSIX-only assertion fails for anyone running the suite on Windows. + vi.spyOn(process, 'platform', 'get').mockReturnValue('darwin') const proc = createMockShellProcess() spawnMock.mockReturnValue(proc) process.env.PATH = `/home/u/.nvm/versions/node/v26.7.0/bin${delimiter}/usr/bin` diff --git a/src/main/startup/hydrate-shell-path.ts b/src/main/startup/hydrate-shell-path.ts index f674d3a49ef..271ace510cf 100644 --- a/src/main/startup/hydrate-shell-path.ts +++ b/src/main/startup/hydrate-shell-path.ts @@ -36,8 +36,8 @@ let probeQueue = Promise.resolve() // ahead of PATH before we probe. nvm's startup `use` honors whatever node is // already on PATH over the user's `default` alias, so a probe that inherits the // seed comes back pinned to that version and every terminal loses the global -// CLIs installed under `default`. Probe with the launch PATH; Windows gets the -// same protection from WindowsShellPathOwnership. +// CLIs installed under `default`. Probe with the launch PATH instead. win32 is +// exempt: it keys PATH as `Path`, and no Windows seed pins a node version. let launchPath: string | null = null let configuredWindowsShell = 'powershell.exe' let configuredWindowsGitBashPath: string | null = null