Fix the time-scons.py --logfiles option.
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Thu, 17 Dec 2009 02:09:50 +0000 (02:09 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Thu, 17 Dec 2009 02:09:50 +0000 (02:09 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@4555 fdb21ef1-2011-0410-befe-b5e4ea1792b1

bin/time-scons.py

index 10684e09a5caafad4eaeb551eae0bf9f732a549d..90c69851251ef16f6a398c8d56c9deaab6b5dfe2 100644 (file)
@@ -114,9 +114,11 @@ class CommandRunner:
             if stdout is sys.stdout:
                 # Same as passing sys.stdout, except works with python2.4.
                 subout = None
-            else:
+            elif stdout is None:
                 # Open pipe for anything else so Popen works on python2.4.
                 subout = subprocess.PIPE
+            else:
+                subout = stdout
             if stderr is sys.stderr:
                 # Same as passing sys.stdout, except works with python2.4.
                 suberr = None
@@ -124,19 +126,12 @@ class CommandRunner:
                 # Merge with stdout if stderr isn't specified.
                 suberr = subprocess.STDOUT
             else:
-                # Open pipe for anything else so Popen works on python2.4.
-                suberr = subprocess.PIPE
+                suberr = stderr
             p = subprocess.Popen(command,
                                  shell=(sys.platform == 'win32'),
                                  stdout=subout,
                                  stderr=suberr)
             p.wait()
-            if stdout is None:
-                self.stdout = p.stdout.read()
-            elif stdout is not sys.stdout:
-                stdout.write(p.stdout.read())
-            if stderr not in (None, sys.stderr):
-                stderr.write(p.stderr.read())
             return p.returncode
 
     def run(self, command, display=None, stdout=None, stderr=None):