summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2002-01-31 21:37:11 (GMT)
committerSteven Knight <knight@baldmt.com>2002-01-31 21:37:11 (GMT)
commit17d45b75a38380cb04553a82cba8eb034deb97cd (patch)
tree1fc4016d007eb86aa99bb7836a82ce9eb745f291 /src
parent97ab3c312201636b0d7aa8f02c91f4bdeba33d04 (diff)
downloadSCons-17d45b75a38380cb04553a82cba8eb034deb97cd.zip
SCons-17d45b75a38380cb04553a82cba8eb034deb97cd.tar.gz
SCons-17d45b75a38380cb04553a82cba8eb034deb97cd.tar.bz2
Flush sys.stdout after every write() so it intermixes properly with sys.stderr when redirected.
Diffstat (limited to 'src')
-rw-r--r--src/CHANGES.txt5
-rw-r--r--src/engine/SCons/Script/__init__.py11
2 files changed, 16 insertions, 0 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt
index d18c55d..7365eb0 100644
--- a/src/CHANGES.txt
+++ b/src/CHANGES.txt
@@ -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
diff --git a/src/engine/SCons/Script/__init__.py b/src/engine/SCons/Script/__init__.py
index 5d87b05..842e7ee 100644
--- a/src/engine/SCons/Script/__init__.py
+++ b/src/engine/SCons/Script/__init__.py
@@ -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: