Bug 1268752 - Bug fix in locating eslint with npm. r=gps
authorHector Zhao <bzhao@mozilla.com>
Fri, 29 Apr 2016 10:50:40 +0800
changeset 295803 d0fc972a906aeddbde6f432dff671fbad869feb6
parent 295802 623941e6df489758f9b75317544bb122d260f2ce
child 295804 d3ada16ac63ddb9612a4f1f58ec309de37474308
push id30228
push usercbook@mozilla.com
push dateTue, 03 May 2016 14:18:10 +0000
treeherdermozilla-central@0a25833062a8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs1268752
milestone49.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1268752 - Bug fix in locating eslint with npm. r=gps MozReview-Commit-ID: 2020nKjC5kL
python/mach_commands.py
--- 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