Skip to content

Commit 6908e81

Browse files
committed
[fix] use which for lookups instead of the shell version
1 parent f5bd656 commit 6908e81

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
var spawn = require('cross-spawn')
44
, shelly = require('shelljs')
5+
, which = require('which')
56
, path = require('path')
67
, util = require('util')
78
, tty = require('tty');
@@ -134,7 +135,7 @@ Hook.prototype.log = function log(lines, exit) {
134135
*/
135136
Hook.prototype.initialize = function initialize() {
136137
['git', 'npm'].forEach(function each(binary) {
137-
try { this[binary] = this.shelly.which(binary); }
138+
try { this[binary] = which.sync(binary); }
138139
catch (e) {}
139140
}, this);
140141

@@ -145,7 +146,7 @@ Hook.prototype.initialize = function initialize() {
145146
if (!this.npm) {
146147
try {
147148
process.env.PATH += path.delimiter + path.dirname(process.env._);
148-
this.npm = this.shelly.which('npm');
149+
this.npm = which.sync('npm');
149150
} catch (e) {
150151
return this.log(this.format(Hook.log.binary, 'npm'), 0);
151152
}

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
"license": "MIT",
3232
"dependencies": {
3333
"cross-spawn": "2.0.x",
34-
"shelljs": "0.5.x"
34+
"shelljs": "0.5.x",
35+
"which": "1.1.x"
3536
},
3637
"devDependencies": {
3738
"assume": "1.2.x",

0 commit comments

Comments
 (0)