-
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathindex.js
More file actions
28 lines (21 loc) · 524 Bytes
/
index.js
File metadata and controls
28 lines (21 loc) · 524 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import process from 'node:process';
import {userInfo} from 'node:os';
export const detectDefaultShell = () => {
const {env} = process;
if (process.platform === 'win32') {
return env.COMSPEC || 'cmd.exe';
}
try {
const {shell} = userInfo();
if (shell) {
return shell;
}
} catch {}
if (process.platform === 'darwin') {
return env.SHELL || '/bin/zsh';
}
return env.SHELL || '/bin/sh';
};
// Stores default shell when imported.
const defaultShell = detectDefaultShell();
export default defaultShell;