Skip to content

Commit

Permalink
use default-shell module
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Jan 23, 2016
1 parent 601ff16 commit 8b3b4f4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
7 changes: 4 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
const childProcess = require('child_process');
const execa = require('execa');
const stripAnsi = require('strip-ansi');
const shell = process.env.SHELL || '/bin/sh';
const defaultShell = require('default-shell');
const user = process.env.USER;
const opts = {encoding: 'utf8'};

Expand All @@ -11,7 +11,7 @@ function clean(str) {
}

function pathFromShell() {
return execa(shell, ['-i', '-c', 'echo "$PATH"'])
return execa(defaultShell, ['-i', '-c', 'echo "$PATH"'])
.then(x => clean(x.stdout) || '')
.catch(() => '');
}
Expand All @@ -23,7 +23,8 @@ function pathFromSudo() {
}

function pathFromShellSync() {
return clean(childProcess.execFileSync(shell, ['-i', '-c', 'echo "$PATH"'], opts)) || '';
const stdout = childProcess.execFileSync(defaultShell, ['-i', '-c', 'echo "$PATH"'], opts);
return clean(stdout) || '';
}

function pathFromSudoSync() {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"nwjs"
],
"dependencies": {
"default-shell": "^1.0.0",
"execa": "^0.2.2",
"strip-ansi": "^3.0.0"
},
Expand Down

0 comments on commit 8b3b4f4

Please sign in to comment.