On Fri, Jun 18, 2010 at 15:34, <hwri...@apache.org> wrote: > Author: hwright > Date: Fri Jun 18 19:34:39 2010 > New Revision: 956106 > > URL: http://svn.apache.org/viewvc?rev=956106&view=rev > Log: > * build/run_tests.py > (_run_py_test): Don't write to the placeholder stdout in the progress func, > write to the real one, or the real bogus one. (This fixes a bug which > could occur if old_stdout isn't valid.) > > Modified: > subversion/trunk/build/run_tests.py > > Modified: subversion/trunk/build/run_tests.py > URL: > http://svn.apache.org/viewvc/subversion/trunk/build/run_tests.py?rev=956106&r1=956105&r2=956106&view=diff > ============================================================================== > --- subversion/trunk/build/run_tests.py (original) > +++ subversion/trunk/build/run_tests.py Fri Jun 18 19:34:39 2010 > @@ -311,8 +311,6 @@ class TestHarness: > old_stderr = os.dup(2) > os.dup2(self.log.fileno(), 1) > os.dup2(self.log.fileno(), 2) > - else: > - old_stdout = sys.stdout > > # This has to be class-scoped for use in the progress_func() > self.dots_written = 0 > @@ -320,8 +318,13 @@ class TestHarness: > dots = (completed * dot_count) / total > > dots_to_write = dots - self.dots_written > - os.write(old_stdout, '.' * dots_to_write) > - os.fsync(old_stdout) > + if self.log: > + os.write(old_stdout, '.' * dots_to_write) > + os.fsync(old_stdout) > + else: > + sys.stdout.write(old_stdout, '.' * dots_to_write) > + sys.stdout.flush()
Doesn't the write() method take a single argument? The contents to write? Seems like a copy/paste problem. And from the os.write() call, it seems that old_stdout is a file descriptor, correct? Why is Python code dealing with file descriptors in the first place? Cheers, -g