diff --git a/Cabal/src/Distribution/Simple/Program/Run.hs b/Cabal/src/Distribution/Simple/Program/Run.hs index 91ab9691bee..66ab3ac82a7 100644 --- a/Cabal/src/Distribution/Simple/Program/Run.hs +++ b/Cabal/src/Distribution/Simple/Program/Run.hs @@ -124,12 +124,10 @@ runProgramInvocation verbosity } = do pathOverride <- getExtraPathEnv envOverrides extraPath menv <- getEffectiveEnvironment (envOverrides ++ pathOverride) - exitCode <- rawSystemIOWithEnv verbosity + maybeExit $ rawSystemIOWithEnv verbosity path args mcwd menv Nothing Nothing Nothing - when (exitCode /= ExitSuccess) $ - exitWith exitCode runProgramInvocation verbosity ProgramInvocation { diff --git a/cabal-install/src/Distribution/Client/ProjectConfig.hs b/cabal-install/src/Distribution/Client/ProjectConfig.hs index eb87215bd7b..2680707f411 100644 --- a/cabal-install/src/Distribution/Client/ProjectConfig.hs +++ b/cabal-install/src/Distribution/Client/ProjectConfig.hs @@ -120,7 +120,7 @@ import Distribution.Simple.InstallDirs ( PathTemplate, fromPathTemplate , toPathTemplate, substPathTemplate, initialPathTemplateEnv ) import Distribution.Simple.Utils - ( die', warn, notice, info, createDirectoryIfMissingVerbose, rawSystemIOWithEnv ) + ( die', warn, notice, info, createDirectoryIfMissingVerbose, maybeExit, rawSystemIOWithEnv ) import Distribution.Client.Utils ( determineNumJobs ) import Distribution.Utils.NubList @@ -1193,8 +1193,7 @@ syncAndReadSourcePackagesRemoteRepos verbosity -- Run post-checkout-command if it is specified for_ repoGroupWithPaths $ \(repo, _, repoPath) -> for_ (nonEmpty (srpCommand repo)) $ \(cmd :| args) -> liftIO $ do - exitCode <- rawSystemIOWithEnv verbosity cmd args (Just repoPath) Nothing Nothing Nothing Nothing - unless (exitCode == ExitSuccess) $ exitWith exitCode + maybeExit $ rawSystemIOWithEnv verbosity cmd args (Just repoPath) Nothing Nothing Nothing Nothing -- But for reading we go through each 'SourceRepo' including its subdir -- value and have to know which path each one ended up in.