Bug 1268752 - Bug fix in locating eslint with npm. r?gps draft
authorHector Zhao <bzhao@mozilla.com>
Fri, 29 Apr 2016 10:50:40 +0800
changeset 357614 50483d7d4c7f1a11f6302c5c073e0c00455d5c27
parent 357432 6adc822f5e27a55551faeb6c47a9bd8b0859a23b
child 519676 09189f2b37f10d41a8e43f08aeb87c2cafa8e5b9
push id16814
push userbzhao@mozilla.com
push dateFri, 29 Apr 2016 02:52:45 +0000
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