Make sure Which() on Windows platform always return the command with extension.

This commit is contained in:
Tingluo Huang 2015-10-05 14:52:26 -04:00
parent ace162ae84
commit 9ca9b6144a

View File

@ -44,10 +44,6 @@ function _which(options, cmd) {
return; // already found it
var attempt = path.resolve(dir + '/' + cmd);
if (checkPath(attempt)) {
where = attempt;
return;
}
if (common.platform === 'win') {
var baseAttempt = attempt;
@ -56,17 +52,22 @@ function _which(options, cmd) {
where = attempt;
return;
}
attempt = baseAttempt + '.cmd';
if (checkPath(attempt)) {
where = attempt;
return;
}
attempt = baseAttempt + '.bat';
if (checkPath(attempt)) {
where = attempt;
return;
}
} // if 'win'
attempt = baseAttempt + '.cmd';
if (checkPath(attempt)) {
where = attempt;
return;
}
} else {
if (checkPath(attempt)) {
where = attempt;
return;
}
}
});
}