Bug 1048446 - [mozprocess] Allow passing in a function as a value to 'processOutputLine', r?gbrown draft
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Mon, 29 May 2017 14:30:29 -0400
changeset 591738 43fe16dae1a02e0b64c154a4ecfb032f2951f92e
parent 591737 4fddf897fe5ca6807b6c8f4ec65abeac6451efa9
child 591739 0bd0a111e3e236116d4a81bc137da617984f1442
push id63159
push userahalberstadt@mozilla.com
push dateFri, 09 Jun 2017 15:00:30 +0000
reviewersgbrown
bugs1048446
milestone55.0a1
Bug 1048446 - [mozprocess] Allow passing in a function as a value to 'processOutputLine', r?gbrown MozReview-Commit-ID: Jqyhbj7nC6z
testing/mozharness/mozprocess/processhandler.py
--- a/testing/mozharness/mozprocess/processhandler.py
+++ b/testing/mozharness/mozprocess/processhandler.py
@@ -899,16 +899,19 @@ class ProcessHandler(ProcessHandlerMixin
 
     If logfile is not None, the output produced by the process will be
     appended to the given file.
     """
 
     def __init__(self, cmd, logfile=None, storeOutput=True, **kwargs):
         kwargs.setdefault('processOutputLine', [])
 
+        if not isinstance(kwargs['processOutputLine'], (list, tuple)):
+            kwargs['processOutputLine'] = [kwargs['processOutputLine']]
+
         # Print to standard output only if no outputline provided
         if not kwargs['processOutputLine']:
             kwargs['processOutputLine'].append(print_output)
 
         if logfile:
             logoutput = LogOutput(logfile)
             kwargs['processOutputLine'].append(logoutput)