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 testsuite: Line-buffer the driver's stdout Python block-buffers stdout when it is a pipe. This is the case for example in CI. As a result there is often no indication of progress at all until the run ends. To fix this, we configure it explicitly to use line buffering instead. stderr is reconfigured too, for consistency: Python line-buffers it by default since 3.9. The type-ignores are for mypy, which types these handles as TextIO — an interface without reconfigure. Fixes #12934. Assisted-by: Claude Fable 5 - - - - - 1 changed file: - testsuite/driver/runtests.py Changes: ===================================== testsuite/driver/runtests.py ===================================== @@ -38,6 +38,12 @@ import term_color from term_color import Color, colored import cpu_features +# Line-buffer stdout: when it is a pipe (as in CI), the block-buffered +# default delays test and progress output (#12934). stderr is included +# for consistency, although Python line-buffers it by default since 3.9. +sys.stdout.reconfigure(line_buffering=True) # type: ignore[union-attr] +sys.stderr.reconfigure(line_buffering=True) # type: ignore[union-attr] + # Readline sometimes spews out ANSI escapes for some values of TERM, # which result in test failures. Thus set TERM to a nice, simple, safe # value. @@ -352,8 +358,6 @@ try: except Exception as e: print('Failed to detect CPU features: ', e) -sys.stdout.flush() - if config.local: tempdir = '' else: @@ -518,9 +522,6 @@ else: except KeyboardInterrupt: pass - # flush everything before we continue - sys.stdout.flush() - # Dump metrics data. print("\nPerformance Metrics (test environment: {}):\n".format(config.test_env)) if config.baseline_commit: View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/66e488aee2c475d18c23f2fd2bf0a013... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/66e488aee2c475d18c23f2fd2bf0a013... You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
participants (1)
-
Simon Jakobi (@sjakobi)