From e2cbb8d7bd2fb382ee710a489686fe27ab6cddf2 Mon Sep 17 00:00:00 2001 From: Jonathan Lange Date: Tue, 27 Mar 2012 12:17:37 +0100 Subject: Factor out subunit-notify --- python/subunit/filters.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'python') diff --git a/python/subunit/filters.py b/python/subunit/filters.py index a221bf7..dc3fd8a 100644 --- a/python/subunit/filters.py +++ b/python/subunit/filters.py @@ -98,15 +98,7 @@ def filter_by_result(result_factory, output_path, passthrough, forward, return result -def _default_post_run(result): - if result.wasSuccessful(): - sys.exit(0) - else: - sys.exit(1) - - -def run_filter_script(result_factory, description, - post_run_hook=_default_post_run): +def run_filter_script(result_factory, description, post_run_hook=None): """Main function for simple subunit filter scripts. Many subunit filter scripts take a stream of subunit input and use a @@ -125,4 +117,9 @@ def run_filter_script(result_factory, description, result = filter_by_result( result_factory, options.output_to, not options.no_passthrough, options.forward) - post_run_hook(result) + if post_run_hook: + post_run_hook(result) + if result.wasSuccessful(): + sys.exit(0) + else: + sys.exit(1) -- cgit v1.2.1