Skip to content

Commit

Permalink
Merge pull request #7847 from Daem0n-th/fix-post-checkout-cmd-bug
Browse files Browse the repository at this point in the history
Fix #7641 : Fix `post-checkout-command` bug
  • Loading branch information
mergify[bot] authored Dec 29, 2021
2 parents 9d9fe65 + 83aeb2a commit 0c77ed4
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cabal-install/src/Distribution/Client/ProjectConfig.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1192,7 +1192,7 @@ syncAndReadSourcePackagesRemoteRepos verbosity
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
unless (exitCode == ExitSuccess) $ exitWith exitCode

-- 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
packages: .

source-repository-package
type: git
-- A Sample repo to test post-checkout-command
location: https://github.com/haskell/bytestring
post-checkout-command: false
-- https://en.wikipedia.org/wiki/True_and_false_(commands)
2 changes: 2 additions & 0 deletions cabal-testsuite/PackageTests/postCheckoutCommand/cabal.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# cabal v2-build
# cabal v2-build
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
packages: .

source-repository-package
type: git
-- A Sample repo to test post-checkout-command
location: https://github.com/haskell/bytestring
post-checkout-command: true
-- https://en.wikipedia.org/wiki/True_and_false_(commands)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import Test.Cabal.Prelude

main = cabalTest $ do
skipIfWindows
withProjectFile "cabal.positive.project" $ do
cabal "v2-build" ["-v0"]
withProjectFile "cabal.negative.project" $ do
fails $ cabal "v2-build" ["-v0"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
cabal-version: 2.4
name: example
version: 1.0

library
exposed-modules: Example
build-depends: base
hs-source-dirs: src
default-language: Haskell2010
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module Example (someFunc) where

someFunc :: IO ()
someFunc = putStrLn "Example"
4 changes: 4 additions & 0 deletions changelog.d/issue-7641
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
synopsis: Fix post-checkout-command crash when 0 exit status bug
issues: #7641
packages: cabal-install
prs: #7847

0 comments on commit 0c77ed4

Please sign in to comment.