summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAles Kozumplik <akozumpl@redhat.com>2010-05-20 15:24:04 +0200
committerAles Kozumplik <akozumpl@redhat.com>2010-05-24 15:13:24 +0200
commitf26db0abd656bbdd54bb1b4bebbf1e69f032901f (patch)
tree6c9d200854b2ce9b4e9a90c21f8ea02fab52655b
parentbac6ee9678b2789c603e5bea4421a82678b4bdc8 (diff)
downloadanaconda-f26db0abd656bbdd54bb1b4bebbf1e69f032901f.tar.gz
anaconda-f26db0abd656bbdd54bb1b4bebbf1e69f032901f.tar.xz
anaconda-f26db0abd656bbdd54bb1b4bebbf1e69f032901f.zip
logging: simplify stdout logging in execWithCallback().
-rw-r--r--iutil.py15
1 files changed, 6 insertions, 9 deletions
diff --git a/iutil.py b/iutil.py
index f115a989f..42ed5d29b 100644
--- a/iutil.py
+++ b/iutil.py
@@ -294,22 +294,18 @@ def execWithCallback(command, argv, stdin = None, stdout = None,
os.close(p[1])
os.close(p_stderr[1])
- logline = ''
+ log_output = ''
while 1:
try:
s = os.read(p[0], 1)
except OSError as e:
if e.errno != 4:
+ map(program_log.info, log_output.splitlines())
raise IOError, e.args
if echo:
os.write(stdout, s)
-
- if s == '\n':
- program_log.info(logline)
- logline = ''
- else:
- logline += s
+ log_output += s
if callback:
callback(s, callback_data=callback_data)
@@ -325,8 +321,8 @@ def execWithCallback(command, argv, stdin = None, stdout = None,
if len(s) < 1:
break
- if len(logline) > 0:
- program_log.info(logline)
+
+ map(program_log.info, log_output.splitlines())
log_errors = ''
while 1:
@@ -334,6 +330,7 @@ def execWithCallback(command, argv, stdin = None, stdout = None,
err = os.read(p_stderr[0], 128)
except OSError as e:
if e.errno != 4:
+ map(program_log.error, log_errors.splitlines())
raise IOError, e.args
break
log_errors += err