Skip to content

Commit

Permalink
Use Process.withCreateProcess to ensure child cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
robx authored and mergify-bot committed Mar 18, 2022
1 parent 67092da commit 0284bfb
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Cabal/src/Distribution/Simple/Utils.hs
Original file line number Diff line number Diff line change
Expand Up @@ -789,9 +789,10 @@ rawSystemProcAction :: Verbosity -> Process.CreateProcess
-> IO (ExitCode, a)
rawSystemProcAction verbosity cp action = withFrozenCallStack $ do
logCommand verbosity cp
(mStdin, mStdout, mStderr, p) <- Process.createProcess cp
a <- action mStdin mStdout mStderr
exitcode <- Process.waitForProcess p
(exitcode, a) <- Process.withCreateProcess cp $ \mStdin mStdout mStderr p -> do
a <- action mStdin mStdout mStderr
exitcode <- Process.waitForProcess p
return (exitcode, a)
unless (exitcode == ExitSuccess) $ do
let cmd = case Process.cmdspec cp of
Process.ShellCommand sh -> sh
Expand Down

0 comments on commit 0284bfb

Please sign in to comment.