diff --git a/src/which.js b/src/which.js index 6d82151..4ea7d03 100644 --- a/src/which.js +++ b/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; + } + } }); }