Bug 914394 - Handle WindowsError on non-Windows; r=ted
authorGregory Szorc <gps@mozilla.com>
Tue, 10 Sep 2013 09:03:43 -0700
changeset 146442 08977d6b4bf19163ce52e6870156787c988af231
parent 146441 fb46afe7f48b31e86a5a78f2c0b7fa6ce25c9f2a
child 146443 12141799ef109e6d03d47398d647d0f609c51183
push id25260
push userryanvm@gmail.com
push dateWed, 11 Sep 2013 00:29:30 +0000
treeherdermozilla-central@f73bed2856a8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs914394
milestone26.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 914394 - Handle WindowsError on non-Windows; r=ted
python/mozbuild/mozbuild/mach_commands.py
--- a/python/mozbuild/mozbuild/mach_commands.py
+++ b/python/mozbuild/mozbuild/mach_commands.py
@@ -475,24 +475,25 @@ class Build(MachCommandBase):
         server.run()
 
     @Command('clobber', category='build',
         description='Clobber the tree (delete the object directory).')
     def clobber(self):
         try:
             self.remove_objdir()
             return 0
-        except WindowsError as e:
-            if e.winerror in (5, 32):
-                self.log(logging.ERROR, 'file_access_error', {'error': e},
-                    "Could not clobber because a file was in use. If the "
-                    "application is running, try closing it. {error}")
-                return 1
-            else:
-                raise
+        except OSError as e:
+            if sys.platform.startswith('win'):
+                if isinstance(e, WindowsError) and e.winerror in (5,32):
+                    self.log(logging.ERROR, 'file_access_error', {'error': e},
+                        "Could not clobber because a file was in use. If the "
+                        "application is running, try closing it. {error}")
+                    return 1
+
+            raise
 
 
 @CommandProvider
 class Warnings(MachCommandBase):
     """Provide commands for inspecting warnings."""
 
     @property
     def database_path(self):