41
*/
42
export function shellTypeForExecutable(shellPath: string): ShellType {
44
>
const lastSep = Math.max(shellPath.lastIndexOf('/'), shellPath.lastIndexOf('\\'));
45
>
const base = shellPath.slice(lastSep + 1).toLowerCase().replace(/\.exe$/, '');
46
>
switch (base) {
47
>
// PowerShell
48
>
case 'pwsh':
49
>
case 'powershell':
50
>
case 'pwsh-preview':
51
return 'powershell';
53
>
case 'bash':
54
>
case 'sh':
55
>
case 'zsh':
56
>
case 'fish':
57
>
case 'csh':
58
>
case 'ksh':
59
>
case 'nu':
60
>
case 'xonsh':
61
>
// Git for Windows bash entry points
62
>
case 'git-cmd':
63
>
// WSL launchers — bash inside, but invoked via these stubs
64
>
case 'wsl':
65
>
case 'ubuntu':
66
>
case 'ubuntu1804':
67
>
case 'kali':
68
>
case 'debian':
69
>
case 'opensuse-42':
70
>
case 'sles-12':
71
>
return 'bash';
72
>
default:
73
return platform.isWindows ? 'powershell' : 'bash';
75
>
}
76
77
/**