Bug 1368656 - Fix ./mach eslint on windows - add a return in the for loop when trying extensions to ensure we get the right one. r=florian

MozReview-Commit-ID: FSXANgWWugE

--HG--
extra : rebase_source : 778bd88977927e72718674d4e7a1c2e6b61adb12
This commit is contained in:
Mark Banner 2017-05-30 14:14:01 +01:00
Родитель b3475703c5
Коммит 7e8a66dc9c
1 изменённых файлов: 3 добавлений и 5 удалений

Просмотреть файл

@ -250,23 +250,21 @@ def which_path(filename):
"""
Return the nodejs or npm path.
"""
path = None
if platform.system() == "Windows":
for ext in [".cmd", ".exe", ""]:
try:
path = which.which(filename + ext, path=get_possible_node_paths_win())
return which.which(filename + ext, path=get_possible_node_paths_win())
except which.WhichError:
pass
else:
try:
path = which.which(filename)
return which.which(filename)
except which.WhichError:
if filename == "node":
# Retry it with "nodejs" as Linux tends to prefer nodejs rather than node.
return which_path("nodejs")
return path
return None
def get_node_or_npm_path(filename, minversion=None):