mirror of
https://github.com/shelljs/shelljs.git
synced 2026-01-25 16:07:37 +00:00
Make sure Which() on Windows platform always return the command with extension.
This commit is contained in:
parent
ace162ae84
commit
9ca9b6144a
21
src/which.js
21
src/which.js
@ -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;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user