Simon Jakobi pushed to branch wip/sjakobi/T12934-line-buffer-stdout at Glasgow Haskell Compiler / GHC
Commits:
-
66e488ae
by Simon Jakobi at 2026-09-10T01:01:59+02:00
1 changed file:
Changes:
| ... | ... | @@ -38,6 +38,12 @@ import term_color |
| 38 | 38 | from term_color import Color, colored
|
| 39 | 39 | import cpu_features
|
| 40 | 40 | |
| 41 | +# Line-buffer stdout: when it is a pipe (as in CI), the block-buffered
|
|
| 42 | +# default delays test and progress output (#12934). stderr is included
|
|
| 43 | +# for consistency, although Python line-buffers it by default since 3.9.
|
|
| 44 | +sys.stdout.reconfigure(line_buffering=True) # type: ignore[union-attr]
|
|
| 45 | +sys.stderr.reconfigure(line_buffering=True) # type: ignore[union-attr]
|
|
| 46 | + |
|
| 41 | 47 | # Readline sometimes spews out ANSI escapes for some values of TERM,
|
| 42 | 48 | # which result in test failures. Thus set TERM to a nice, simple, safe
|
| 43 | 49 | # value.
|
| ... | ... | @@ -352,8 +358,6 @@ try: |
| 352 | 358 | except Exception as e:
|
| 353 | 359 | print('Failed to detect CPU features: ', e)
|
| 354 | 360 | |
| 355 | -sys.stdout.flush()
|
|
| 356 | - |
|
| 357 | 361 | if config.local:
|
| 358 | 362 | tempdir = ''
|
| 359 | 363 | else:
|
| ... | ... | @@ -518,9 +522,6 @@ else: |
| 518 | 522 | except KeyboardInterrupt:
|
| 519 | 523 | pass
|
| 520 | 524 | |
| 521 | - # flush everything before we continue
|
|
| 522 | - sys.stdout.flush()
|
|
| 523 | - |
|
| 524 | 525 | # Dump metrics data.
|
| 525 | 526 | print("\nPerformance Metrics (test environment: {}):\n".format(config.test_env))
|
| 526 | 527 | if config.baseline_commit:
|