Bug 796840 - Don't have mozprocess worry about process children when running make; r=jhammel
authorGregory Szorc <gps@mozilla.com>
Thu, 04 Oct 2012 17:23:06 -0700
changeset 109246 a119cc1cdf0a728990df7c17dcba3e1ca28ae45d
parent 109245 fd724f194a1f65540289872d7c97765623f81bc0
child 109247 a7619ca2db7e5e6a51f65a88387786c9b8583048
push id23617
push usergszorc@mozilla.com
push dateFri, 05 Oct 2012 00:24:22 +0000
treeherdermozilla-central@a119cc1cdf0a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjhammel
bugs796840
milestone18.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 796840 - Don't have mozprocess worry about process children when running make; r=jhammel DONTBUILD (NPOTB)
python/mozbuild/mozbuild/base.py
--- a/python/mozbuild/mozbuild/base.py
+++ b/python/mozbuild/mozbuild/base.py
@@ -243,16 +243,21 @@ class MozbuildObject(object):
         params = {
             'args': args,
             'line_handler': line_handler,
             'append_env': append_env,
             'explicit_env': explicit_env,
             'log_level': logging.INFO,
             'require_unix_environment': True,
             'ignore_errors': ignore_errors,
+
+            # Make manages its children, so mozprocess doesn't need to bother.
+            # Having mozprocess manage children can also have side-effects when
+            # building on Windows. See bug 796840.
+            'ignore_children': True,
         }
 
         if log:
             params['log_name'] = 'make'
 
         fn(**params)
 
     @property
@@ -279,31 +284,33 @@ class MozbuildObject(object):
         self._run_command(cwd=self.topsrcdir, **args)
 
     def _run_command_in_objdir(self, **args):
         self._run_command(cwd=self.topobjdir, **args)
 
     def _run_command(self, args=None, cwd=None, append_env=None,
         explicit_env=None, log_name=None, log_level=logging.INFO,
         line_handler=None, require_unix_environment=False,
-        ignore_errors=False):
+        ignore_errors=False, ignore_children=False):
         """Runs a single command to completion.
 
         Takes a list of arguments to run where the first item is the
         executable. Runs the command in the specified directory and
         with optional environment variables.
 
         append_env -- Dict of environment variables to append to the current
             set of environment variables.
         explicit_env -- Dict of environment variables to set for the new
             process. Any existing environment variables will be ignored.
 
         require_unix_environment if True will ensure the command is executed
         within a UNIX environment. Basically, if we are on Windows, it will
         execute the command via an appropriate UNIX-like shell.
+
+        ignore_children is proxied to mozprocess's ignore_children.
         """
         args = self._normalize_command(args, require_unix_environment)
 
         self.log(logging.INFO, 'process', {'args': args}, ' '.join(args))
 
         def handleLine(line):
             # Converts str to unicode on Python 2 and bytes to str on Python 3.
             if isinstance(line, bytes):
@@ -324,17 +331,18 @@ class MozbuildObject(object):
             use_env.update(os.environ)
 
             if append_env:
                 use_env.update(append_env)
 
         self.log(logging.DEBUG, 'process', {'env': use_env}, 'Environment: {env}')
 
         p = ProcessHandlerMixin(args, cwd=cwd, env=use_env,
-            processOutputLine=[handleLine], universal_newlines=True)
+            processOutputLine=[handleLine], universal_newlines=True,
+            ignore_children=ignore_children)
         p.run()
         p.processOutput()
         status = p.wait()
 
         if status != 0 and not ignore_errors:
             raise Exception('Process executed with non-0 exit code: %s' % args)
 
     def _normalize_command(self, args, require_unix_environment):