[master 4/6] logging: simplify stdout logging in execWithCallback().

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 iutil.py |   13 ++++---------
 1 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/iutil.py b/iutil.py
index 63582c4..d026bcf 100644
--- a/iutil.py
+++ b/iutil.py
@@ -294,7 +294,7 @@ 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)
@@ -304,12 +304,7 @@ def execWithCallback(command, argv, stdin = None, stdout = None,
 
         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 +320,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:
-- 
1.6.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux