diff options
author | Ales Kozumplik <akozumpl@redhat.com> | 2010-05-20 15:24:04 +0200 |
---|---|---|
committer | Ales Kozumplik <akozumpl@redhat.com> | 2010-05-24 15:13:24 +0200 |
commit | f26db0abd656bbdd54bb1b4bebbf1e69f032901f (patch) | |
tree | 6c9d200854b2ce9b4e9a90c21f8ea02fab52655b | |
parent | bac6ee9678b2789c603e5bea4421a82678b4bdc8 (diff) | |
download | anaconda-f26db0abd656bbdd54bb1b4bebbf1e69f032901f.tar.gz anaconda-f26db0abd656bbdd54bb1b4bebbf1e69f032901f.tar.xz anaconda-f26db0abd656bbdd54bb1b4bebbf1e69f032901f.zip |
logging: simplify stdout logging in execWithCallback().
-rw-r--r-- | iutil.py | 15 |
1 files changed, 6 insertions, 9 deletions
@@ -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 |