Skip to content

Commit

Permalink
Flush stdout/stderr after running commands...?
Browse files Browse the repository at this point in the history
Noticed here: #10573 (comment)
  • Loading branch information
9999years committed Dec 10, 2024
1 parent 96bc9c3 commit 5e05c8d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cabal-validate/src/ProcessUtil.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 5e05c8d

Please sign in to comment.