From e6667dbd895829588f70930b60c3be097ac7e394 Mon Sep 17 00:00:00 2001 From: Tom Ellis Date: Mon, 22 May 2023 19:19:37 +0100 Subject: [PATCH] Remove duplication between branches --- src/System/Process/Typed.hs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/System/Process/Typed.hs b/src/System/Process/Typed.hs index 9c69eaf..b2a0374 100644 --- a/src/System/Process/Typed.hs +++ b/src/System/Process/Typed.hs @@ -257,8 +257,7 @@ startProcess pConfig'@ProcessConfig {..} = liftIO $ do -- then call waitForProcess ourselves Left _ -> do eres <- try $ P.terminateProcess pHandle - ec <- - case eres of + case eres of Left e -- On Windows, with the single-threaded runtime, it -- seems that if a process has already exited, the @@ -272,9 +271,10 @@ startProcess pConfig'@ProcessConfig {..} = liftIO $ do -- Recommendation: always use the multi-threaded -- runtime! | isPermissionError e && not multiThreadedRuntime && isWindows -> - P.waitForProcess pHandle - | otherwise -> throwIO e >> P.waitForProcess pHandle - Right () -> P.waitForProcess pHandle + pure () + | otherwise -> throwIO e + Right () -> pure () + ec <- P.waitForProcess pHandle success <- atomically $ tryPutTMVar pExitCode ec evaluate $ assert success ()