]> git.michaelhowe.org Git - packages/b/bup.git/commitdiff
helpers.log(): run sys.stdout.flush() first.
authorAvery Pennarun <apenwarr@gmail.com>
Thu, 1 Apr 2010 18:58:00 +0000 (14:58 -0400)
committerAvery Pennarun <apenwarr@gmail.com>
Thu, 1 Apr 2010 18:58:00 +0000 (14:58 -0400)
It's annoying when your log messages come out before stdout messages do.
But it's equally annoying (and inefficient) to have to flush every time you
print something.  This seems like a nice compromise.

lib/bup/helpers.py

index d8d416f49f80aec88988d90c1ea9744f145cc68f..6a9857494343aa8c103976a18caa735b4b705fac 100644 (file)
@@ -19,6 +19,7 @@ def _hard_write(fd, buf):
         buf = buf[sz:]
 
 def log(s):
+    sys.stdout.flush()
     _hard_write(sys.stderr.fileno(), s)