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

[master] fix for a bug in 05ce88b2 that split one line over several in program.log



---
 iutil.py |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/iutil.py b/iutil.py
index e01fd8c..dd78f54 100644
--- a/iutil.py
+++ b/iutil.py
@@ -277,7 +277,7 @@ def execWithCallback(command, argv, stdin = None, stdout = None,
     elif stderr is None or not isinstance(stderr, file):
         stderr = sys.stderr.fileno()
 
-    program_log.info("Running... %s\n" % ([command] + argv,))
+    program_log.info("Running... %s" % ([command] + argv,))
 
     p = os.pipe()
     childpid = os.fork()
@@ -295,6 +295,7 @@ def execWithCallback(command, argv, stdin = None, stdout = None,
 
     os.close(p[1])
 
+    logline = ''
     while 1:
         try:
             s = os.read(p[0], 1)
@@ -305,7 +306,11 @@ def execWithCallback(command, argv, stdin = None, stdout = None,
         if echo:
             os.write(stdout, s)
 
-        map(program_log.info, s.splitlines())
+        if s == '\n':
+            program_log.info(logline)
+            logline = ''
+        else:
+            logline += s;
 
         if callback:
             callback(s, callback_data=callback_data)
-- 
1.6.2.5


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