summaryrefslogtreecommitdiff
path: root/source/Provers.hs
diff options
context:
space:
mode:
authoradelon <22380201+adelon@users.noreply.github.com>2026-02-17 14:56:41 +0100
committeradelon <22380201+adelon@users.noreply.github.com>2026-02-17 14:56:41 +0100
commitfb350ec83e12b1dc4c6e80b1482316e5891fa0ad (patch)
tree39d75e796820cb9610ea3b88cc6038a829b6d4b8 /source/Provers.hs
parent1122576d9283d499915ec4d0a87ee8cf03e5339e (diff)
Fix queue behavior upon encoding crash
Diffstat (limited to 'source/Provers.hs')
-rw-r--r--source/Provers.hs15
1 files changed, 11 insertions, 4 deletions
diff --git a/source/Provers.hs b/source/Provers.hs
index 2c1e48c..d9f8936 100644
--- a/source/Provers.hs
+++ b/source/Provers.hs
@@ -16,9 +16,10 @@ import Data.Text qualified as Text
import Data.Text.IO qualified as TextIO
import Data.Time
import System.Exit (ExitCode)
-import System.IO (hClose)
+import System.IO (hClose, hSetEncoding, utf8)
import System.Process (CreateProcess(..), StdStream(CreatePipe), createProcess, proc, waitForProcess)
import TextBuilder
+import UnliftIO.Async (concurrently)
type Prover = Verbosity -> TimeLimit -> MemoryLimit -> ProverInstance
@@ -150,11 +151,17 @@ runProverProcess :: FilePath -> [String] -> Task -> IO (ExitCode, Text, Text)
runProverProcess path args task = do
(Just hin, Just hout, Just herr, ph) <-
createProcess (proc path args){std_in = CreatePipe, std_out = CreatePipe, std_err = CreatePipe}
+
+ hSetEncoding hin utf8
+ hSetEncoding hout utf8
+ hSetEncoding herr utf8
writeTask hin task
hClose hin
- out <- TextIO.hGetContents hout
- err <- TextIO.hGetContents herr
- _ <- evaluate (Text.length out + Text.length err)
+ let consumeStrict h = do
+ txt <- TextIO.hGetContents h
+ _ <- evaluate (Text.length txt)
+ pure txt
+ (out, err) <- concurrently (consumeStrict hout) (consumeStrict herr)
exitCode <- waitForProcess ph
pure (exitCode, out, err)