From: stevenknight Date: Thu, 31 Jan 2002 21:37:11 +0000 (+0000) Subject: Flush sys.stdout after every write() so it intermixes properly with sys.stderr when... X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=17f1fd52ab5330212d7ade6aca33a413da20b7cd;p=scons.git Flush sys.stdout after every write() so it intermixes properly with sys.stderr when redirected. git-svn-id: http://scons.tigris.org/svn/scons/trunk@237 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- diff --git a/src/CHANGES.txt b/src/CHANGES.txt index d18c55dd..7365eb0e 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 5d87b052..842e7eef 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: