Skip to content

Commit 67b4801

Browse files
authored
Improve shell identifier on case-insensitive system (#22391)
Use case-insensitive regex to remove `.exe` extension. See: #22036 (comment)
1 parent 7bc45e5 commit 67b4801

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/client/common/terminal/shellDetectors/baseShellDetector.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export abstract class BaseShellDetector implements IShellDetector {
6363
export function identifyShellFromShellPath(shellPath: string): TerminalShellType {
6464
// Remove .exe extension so shells can be more consistently detected
6565
// on Windows (including Cygwin).
66-
const basePath = shellPath.replace(/\.exe$/, '');
66+
const basePath = shellPath.replace(/\.exe$/i, '');
6767

6868
const shell = Array.from(detectableShells.keys()).reduce((matchedShell, shellToDetect) => {
6969
if (matchedShell === TerminalShellType.other) {

src/test/common/terminals/shellDetectors/shellDetectors.unit.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ suite('Shell Detectors', () => {
4141
shellPathsAndIdentification.set('/usr/bin/ksh', TerminalShellType.ksh);
4242
shellPathsAndIdentification.set('c:\\windows\\system32\\powershell.exe', TerminalShellType.powershell);
4343
shellPathsAndIdentification.set('c:\\windows\\system32\\pwsh.exe', TerminalShellType.powershellCore);
44+
shellPathsAndIdentification.set('C:\\Program Files\\nu\\bin\\nu.EXE', TerminalShellType.nushell);
4445
shellPathsAndIdentification.set('/usr/microsoft/xxx/powershell/powershell', TerminalShellType.powershell);
4546
shellPathsAndIdentification.set('/usr/microsoft/xxx/powershell/pwsh', TerminalShellType.powershellCore);
4647
shellPathsAndIdentification.set('/usr/bin/fish', TerminalShellType.fish);

0 commit comments

Comments
 (0)