Bug 1211223 - Error running eslint setup on Windows r=mh+mozilla, r=pbro
authorMichael Ratcliffe <mratcliffe@mozilla.com>
Fri, 23 Oct 2015 14:36:24 +0100
changeset 304333 9200ea11d07f7273a7e404bb8ba07a0ab2d7c36b
parent 304332 9a21365f7a4ad6b8eb3d97bf360468228afcb89d
child 304334 a829347b8691b54ab85103a9c391a8d6ce5c2b28
push id1001
push userraliiev@mozilla.com
push dateMon, 18 Jan 2016 19:06:03 +0000
treeherdermozilla-release@8b89261f3ac4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmh, pbro
bugs1211223
milestone44.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 1211223 - Error running eslint setup on Windows r=mh+mozilla, r=pbro
python/mach_commands.py
--- a/python/mach_commands.py
+++ b/python/mach_commands.py
@@ -261,40 +261,39 @@ class MachCommands(MachCommandBase):
 
     def getPossibleNodePathsWin(self):
         """
         Return possible nodejs paths on Windows.
         """
         if platform.system() != "Windows":
             return []
 
-        return {
+        return list({
             "%s\\nodejs" % os.environ.get("SystemDrive"),
             os.path.join(os.environ.get("ProgramFiles"), "nodejs"),
             os.path.join(os.environ.get("PROGRAMW6432"), "nodejs"),
             os.path.join(os.environ.get("PROGRAMFILES"), "nodejs")
-        }
+        })
 
     def getNodeOrNpmPath(self, filename):
         """
         Return the nodejs or npm path.
         """
-        try:
-            appPath = which.which(filename)
-            return appPath
-        except which.WhichError:
-            pass
-
         if platform.system() == "Windows":
-            try:
-                for ext in ["", ".cmd", ".exe"]:
+            for ext in [".cmd", ".exe", ""]:
+                try:
                     nodeOrNpmPath = which.which(filename + ext,
                                                 path=self.getPossibleNodePathsWin())
                     if self.is_valid(nodeOrNpmPath):
                         return nodeOrNpmPath
+                except which.WhichError:
+                    pass
+        else:
+            try:
+                return which.which(filename)
             except which.WhichError:
                 pass
 
         if filename == "node":
             print(NODE_NOT_FOUND_MESSAGE)
         elif filename == "npm":
             print(NPM_NOT_FOUND_MESSAGE)
 
@@ -310,10 +309,10 @@ class MachCommands(MachCommandBase):
 
         return None
 
     def is_valid(self, path):
         try:
             with open(os.devnull, "w") as fnull:
                 subprocess.check_call([path, "--version"], stdout=fnull)
                 return True
-        except subprocess.CalledProcessError:
+        except (subprocess.CalledProcessError, WindowsError):
             return False