Skip to content

Commit ab52d08

Browse files
committed
Use Process.withCreateProcess to ensure child cleanup
1 parent cc8a7af commit ab52d08

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Cabal/src/Distribution/Simple/Utils.hs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -789,9 +789,10 @@ rawSystemProcAction :: Verbosity -> Process.CreateProcess
789789
-> IO (ExitCode, a)
790790
rawSystemProcAction verbosity cp action = withFrozenCallStack $ do
791791
logCommand verbosity cp
792-
(mStdin, mStdout, mStderr, p) <- Process.createProcess cp
793-
a <- action mStdin mStdout mStderr
794-
exitcode <- Process.waitForProcess p
792+
(exitcode, a) <- Process.withCreateProcess cp $ \mStdin mStdout mStderr p -> do
793+
a <- action mStdin mStdout mStderr
794+
exitcode <- Process.waitForProcess p
795+
return (exitcode, a)
795796
unless (exitcode == ExitSuccess) $ do
796797
let cmd = case Process.cmdspec cp of
797798
Process.ShellCommand sh -> sh

0 commit comments

Comments
 (0)