Attempt to force subprocess output to use linewise buffering

Lennart Spitzner 2023-02-21 17:21:40 +01:00
parent 49ffea3f2e
commit 7125e0e5b6
1 changed files with 2 additions and 0 deletions

View File

@ -853,6 +853,8 @@ main = B.mainFromCmdParser $ do
let mainBlock =
P.withCreateProcess ((P.proc restPath restArgs) { P.std_in = P.CreatePipe, P.std_out = P.CreatePipe, P.std_err = P.CreatePipe, P.env = Just innerEnv })
$ \(Just inp) (Just out) (Just err) hdl -> do
System.IO.hSetBuffering out System.IO.LineBuffering
System.IO.hSetBuffering err System.IO.LineBuffering
A.withAsync (inHandler inp) $ \inAsync -> A.withAsync (outHandler out) $ \outAsync -> A.withAsync (errHandler err) $ \errAsync ->
A.withAsync tickHandler $ \_tickAsync -> do
ec <- P.waitForProcess hdl