[PATCH] check if stdout and stderr are the same in execWithRedirect and open the file only once in such cases resolves #750710

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

 



From: Masahiro Matsuya <mmatsuya@xxxxxxxxxx>

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

diff --git a/iutil.py b/iutil.py
index 80045c5..898bfe0 100644
--- a/iutil.py
+++ b/iutil.py
@@ -99,6 +99,7 @@ def execWithRedirect(command, argv, stdin = None, stdout = None,
     elif stdin is None or not isinstance(stdin, file):
         stdin = sys.stdin.fileno()
 
+    orig_stdout = stdout
     if isinstance(stdout, str):
         stdout = os.open(stdout, os.O_RDWR|os.O_CREAT)
         stdoutclose = lambda : os.close(stdout)
@@ -107,7 +108,9 @@ def execWithRedirect(command, argv, stdin = None, stdout = None,
     elif stdout is None or not isinstance(stdout, file):
         stdout = sys.stdout.fileno()
 
-    if isinstance(stderr, str):
+    if isinstance(stderr, str) and isinstance(orig_stdout, str) and stderr == orig_stdout:
+        stderr = stdout
+    elif isinstance(stderr, str):
         stderr = os.open(stderr, os.O_RDWR|os.O_CREAT)
         stderrclose = lambda : os.close(stderr)
     elif isinstance(stderr, int):
-- 
1.7.4.4

_______________________________________________
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