Skip to content

Commit

Permalink
Use maybeExit in more places
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 0184445 commit 67092da
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
4 changes: 1 addition & 3 deletions Cabal/src/Distribution/Simple/Program/Run.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 2 additions & 3 deletions cabal-install/src/Distribution/Client/ProjectConfig.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 67092da

Please sign in to comment.