Flush sys.stdout after every write() so it intermixes properly with sys.stderr when...
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Thu, 31 Jan 2002 21:37:11 +0000 (21:37 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Thu, 31 Jan 2002 21:37:11 +0000 (21:37 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@237 fdb21ef1-2011-0410-befe-b5e4ea1792b1

src/CHANGES.txt
src/engine/SCons/Script/__init__.py

index d18c55dd5a26f6edfa9c0f1b324f34d5f16b4926..7365eb0e00f971351b0f5fe09f9ffe6af8fc5526 100644 (file)
@@ -15,6 +15,11 @@ RELEASE 0.05 -
   - Allow a library to specified as a command-line source file, not just
     in the LIBS construction variable.
 
+  From Steven Knight:
+
+  - Flush stdout after print so it intermixes correctly with stderr
+    when redirected.
+
 
 
 RELEASE 0.04 - Wed, 30 Jan 2002 11:09:42 -0600
index 5d87b05252416ca5a97d946f2a237a741943e285..842e7eefb802b90e050fabe05f4c88ddc8ee8d21 100644 (file)
@@ -639,6 +639,17 @@ def _main():
        else:
            raise UserError, "No SConstruct file found."
 
+    class Unbuffered:
+        def __init__(self, file):
+            self.file = file
+        def write(self, arg):
+            self.file.write(arg)
+            self.file.flush()
+        def __getattr__(self, attr):
+            return getattr(self.file, attr)
+
+    sys.stdout = Unbuffered(sys.stdout)
+
     sys.path = include_dirs + sys.path
 
     for script in scripts: