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 320269 d0fc972a906aeddbde6f432dff671fbad869feb6
parent 320268 623941e6df489758f9b75317544bb122d260f2ce
child 320270 d3ada16ac63ddb9612a4f1f58ec309de37474308
push id9671
push userraliiev@mozilla.com
push dateMon, 06 Jun 2016 20:27:52 +0000
treeherdermozilla-aurora@cea65ca3d0bd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs1268752
milestone49.0a1
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