From 5e05c8db8620dce72d38cba82dfe1ef71f3ced35 Mon Sep 17 00:00:00 2001 From: Rebecca Turner Date: Tue, 10 Dec 2024 11:05:05 -0800 Subject: [PATCH] Flush stdout/stderr after running commands...? Noticed here: https://github.com/haskell/cabal/pull/10573#issuecomment-2532562835 --- cabal-validate/src/ProcessUtil.hs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cabal-validate/src/ProcessUtil.hs b/cabal-validate/src/ProcessUtil.hs index 86c5c16e73f..7ed88774865 100644 --- a/cabal-validate/src/ProcessUtil.hs +++ b/cabal-validate/src/ProcessUtil.hs @@ -15,6 +15,7 @@ import qualified Data.Text.Lazy as T (toStrict) import qualified Data.Text.Lazy.Encoding as T (decodeUtf8) import System.Directory (withCurrentDirectory) import System.Exit (ExitCode (ExitFailure, ExitSuccess)) +import System.IO (hFlush, stdout, stderr) import System.Process.Typed (ExitCodeException (..), proc, readProcess, runProcess) import ANSI (SGR (BrightBlue, BrightGreen, BrightRed, Reset), setSGR) @@ -65,6 +66,8 @@ timed opts command args = do if verbosity opts > Quiet then do exitCode <- runProcess process + hFlush stdout + hFlush stderr pure (exitCode, ByteString.empty, ByteString.empty) else readProcess process