Skip to content

Commit

Permalink
Fix virtual env won't load on linux (#866)
Browse files Browse the repository at this point in the history
* reset env in uv shell on linux

* update test

* revert env reset

* update test expectation

* target linux explicitly, preserve original fallback
  • Loading branch information
christian-byrne authored Feb 9, 2025
1 parent c69fd21 commit 5f46874
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
9 changes: 8 additions & 1 deletion src/shell/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,12 @@ export function getDefaultShell(): string {
}

export function getDefaultShellArgs(): string[] {
return os.platform() === 'darwin' ? ['-df'] : [];
switch (os.platform()) {
case 'darwin':
return ['-df']; // Prevent loading initialization files for zsh
case 'linux':
return ['--noprofile', '--norc'];
default:
return [];
}
}
4 changes: 2 additions & 2 deletions tests/unit/shell/util.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ describe('shell utilities', () => {
expect(getDefaultShellArgs()).toEqual([]);
});

it('should return empty array on Linux', () => {
it('should return noprofile and norc on Linux', () => {
vi.spyOn(os, 'platform').mockReturnValue('linux');
expect(getDefaultShellArgs()).toEqual([]);
expect(getDefaultShellArgs()).toEqual(['--noprofile', '--norc']);
});
});
});

0 comments on commit 5f46874

Please sign in to comment.