Bug 1315805 - [mozlint] Make sure multiprocess' stdout gets flushed in lint tasks, r=dustin
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Tue, 08 Nov 2016 13:33:13 -0500
changeset 348332 d0a3a42979e805db3b896ca786ed61ba85d9a6a7
parent 348331 d5a021318c9a4393b9ff40da7110daf88522aa24
child 348333 2133a6ec73c4295a49c452c95b66f41826229e64
push id10298
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:33:03 +0000
treeherdermozilla-aurora@7e29173b1641 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdustin
bugs1315805
milestone52.0a1
Bug 1315805 - [mozlint] Make sure multiprocess' stdout gets flushed in lint tasks, r=dustin MozReview-Commit-ID: FhOI92JySXg
python/mozlint/mozlint/roller.py
--- a/python/mozlint/mozlint/roller.py
+++ b/python/mozlint/mozlint/roller.py
@@ -1,16 +1,17 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 from __future__ import unicode_literals
 
 import os
 import signal
+import sys
 import traceback
 from collections import defaultdict
 from Queue import Empty
 from multiprocessing import (
     Manager,
     Pool,
     cpu_count,
 )
@@ -57,16 +58,18 @@ def _run_linters(queue, paths, **lintarg
 def _run_worker(*args, **lintargs):
     try:
         return _run_linters(*args, **lintargs)
     except Exception:
         # multiprocessing seems to munge worker exceptions, print
         # it here so it isn't lost.
         traceback.print_exc()
         raise
+    finally:
+        sys.stdout.flush()
 
 
 class LintRoller(object):
     """Registers and runs linters.
 
     :param root: Path to which relative paths will be joined. If
                  unspecified, root will either be determined from
                  version control or cwd.