Bug 1268752 - Bug fix in locating eslint with npm. r?gps
MozReview-Commit-ID: 2020nKjC5kL
--- a/python/mach_commands.py
+++ b/python/mach_commands.py
@@ -216,20 +216,20 @@ class MachCommands(MachCommandBase):
try:
binary = which.which('eslint')
except which.WhichError:
npmPath = self.getNodeOrNpmPath("npm")
if npmPath:
try:
output = subprocess.check_output([npmPath, "bin", "-g"],
stderr=subprocess.STDOUT)
- if minversion:
- base = output.split("\n").strip()
+ if output:
+ base = output.split("\n")[0].strip()
binary = os.path.join(base, "eslint")
- if not os.path.is_file(binary):
+ if not os.path.isfile(binary):
binary = None
except (subprocess.CalledProcessError, WindowsError):
pass
if not binary:
print(ESLINT_NOT_FOUND_MESSAGE)
return 1