Skip to content

Commit 4ee348b

Browse files
committed
RFCT Use Conduit.Process.Typed.createSinkClose
This was not previously available (and so the Handle had to be closed by ourselves)
1 parent e3e45d7 commit 4ee348b

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

NGLess/Utils/Process.hs

+2-7
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,13 @@ runProcess binPath args stdin stdout = do
4343
CPT.withProcessWait (
4444
-- No need to keep these open
4545
CPT.setCloseFds True
46-
-- We need the Handle for stdin because we need to hClose it!
47-
-- Therefore, we cannot use `CPT.setStdin CTP.createSink`
48-
$ CPT.setStdin CPT.createPipe
46+
$ CPT.setStdin CPT.createSinkClose
4947
$ CPT.setStderr CPT.byteStringOutput
5048
$ CPT.setStdout CPT.createSource
5149
$ CPT.proc binPath args) $ \p ->
5250
U.runConcurrently $ (,,)
5351
<$> U.Concurrently (CPT.waitExitCode p)
54-
<* U.Concurrently (do
55-
let hin = CPT.getStdin p
56-
C.runConduit (stdin .| CC.sinkHandle hin)
57-
U.hClose hin)
52+
<* U.Concurrently (C.runConduit (stdin .| CPT.getStdin p))
5853
<*> U.Concurrently (C.runConduit (CPT.getStdout p .| stdout'))
5954
<*> U.Concurrently (liftIO $ STM.atomically (CPT.getStderr p))
6055
let err' = BL8.unpack err

0 commit comments

Comments
 (0)