From a072c43bd72437b82cace9f2d6f93ac76504622f Mon Sep 17 00:00:00 2001 From: Tony Mack Date: Tue, 22 Jan 2008 22:29:33 +0000 Subject: [PATCH] remove output generated by 'set x' from stderr --- qaapi/qa/utils.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/qaapi/qa/utils.py b/qaapi/qa/utils.py index 971ff52..38132bf 100644 --- a/qaapi/qa/utils.py +++ b/qaapi/qa/utils.py @@ -1,7 +1,21 @@ # $Id$ import time +import os -# how could this accept a list again ? def header(message): now=time.strftime("%H:%M:%S", time.localtime()) print "*",now,'--',message + + +def popen(command, fatal=True): + (stdin, stdout, stderr) = os.popen3(command) + output = stdout.readlines() + + # filter output generated by set x + remove_set_x = lambda line: not line.startswith("+") + errors = filter(remove_set_x, stderr.readlines()) + + if fatal and errors: + raise Exception, "\n".join(errors) + return (output, errors) + -- 2.47.0