From 10d4fd354251705e8ea6d6ed570c67a981758f0d Mon Sep 17 00:00:00 2001 From: Alberto Planas Date: Thu, 26 Jun 2014 11:46:37 +0200 Subject: [PATCH] Makes sure that stdout is restored. --- osc-check_source.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/osc-check_source.py b/osc-check_source.py index abd7a32f..067f057b 100644 --- a/osc-check_source.py +++ b/osc-check_source.py @@ -26,8 +26,10 @@ def _silent_running(fn): def _fn(*args, **kwargs): _stdout = sys.stdout sys.stdout = open(os.devnull, 'wb') - result = fn(*args, **kwargs) - sys.stdout = _stdout + try: + result = fn(*args, **kwargs) + finally: + sys.stdout = _stdout return result return _fn