Bug 1048446 - [mozprocess] Allow passing in a function as a value to 'processOutputLine', r=gbrown

MozReview-Commit-ID: Jqyhbj7nC6z

--HG--
extra : rebase_source : f3401977e96dc91543454f153c5fe22961b352ae
This commit is contained in:
Andrew Halberstadt 2017-05-29 14:30:29 -04:00
parent c9821f47ec
commit f121d2e5b6

View File

@ -904,6 +904,9 @@ class ProcessHandler(ProcessHandlerMixin):
def __init__(self, cmd, logfile=None, storeOutput=True, **kwargs): def __init__(self, cmd, logfile=None, storeOutput=True, **kwargs):
kwargs.setdefault('processOutputLine', []) kwargs.setdefault('processOutputLine', [])
if not isinstance(kwargs['processOutputLine'], (list, tuple)):
kwargs['processOutputLine'] = [kwargs['processOutputLine']]
# Print to standard output only if no outputline provided # Print to standard output only if no outputline provided
if not kwargs['processOutputLine']: if not kwargs['processOutputLine']:
kwargs['processOutputLine'].append(print_output) kwargs['processOutputLine'].append(print_output)