Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e2d1214

Browse files
committed
[Bug #620630] Flush stdout after logging every message. Without it,
when output is redirected to a file, compiler error messages show up before Distutils prints the command being invoked.
1 parent 33a5edf commit e2d1214

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

Lib/distutils/log.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
ERROR = 4
1010
FATAL = 5
1111

12+
import sys
13+
1214
class Log:
1315

1416
def __init__(self, threshold=WARN):
@@ -17,6 +19,7 @@ def __init__(self, threshold=WARN):
1719
def _log(self, level, msg, args):
1820
if level >= self.threshold:
1921
print msg % args
22+
sys.stdout.flush()
2023

2124
def log(self, level, msg, *args):
2225
self._log(level, msg, args)

0 commit comments

Comments
 (0)