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

[PATCH] Do not use communicate() when we redirect to file desc, it changes line buffering to block buffering which makes interactive scripts in kickstart impossible to use (#506664)



---
 iutil.py |   18 ++++--------------
 1 files changed, 4 insertions(+), 14 deletions(-)

diff --git a/iutil.py b/iutil.py
index ba1d0b4..1e90025 100644
--- a/iutil.py
+++ b/iutil.py
@@ -87,23 +87,13 @@ def execWithRedirect(command, argv, stdin = None, stdout = None,
 
     try:
         proc = subprocess.Popen([command] + argv, stdin=stdin,
-                                stdout=subprocess.PIPE,
-                                stderr=subprocess.PIPE,
+                                stdout=stdout,
+                                stderr=stderr,
                                 preexec_fn=chroot, cwd=root,
                                 env=env)
+        proc.wait()
+        ret = proc.returncode
 
-        while True:
-            (outStr, errStr) = proc.communicate()
-            if outStr:
-                os.write(stdout, outStr)
-                runningLog.write(outStr)
-            if errStr:
-                os.write(stderr, errStr)
-                runningLog.write(errStr)
-
-            if proc.returncode is not None:
-                ret = proc.returncode
-                break
     except OSError as e:
         errstr = "Error running %s: %s" % (command, e.strerror)
         log.error(errstr)
-- 
1.5.4.3


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