Skip to content

Commit

Permalink
Exit with exitFailure when generation of .cabal file fails
Browse files Browse the repository at this point in the history
  • Loading branch information
sol committed Mar 16, 2018
1 parent e14b0ad commit 8954510
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## next
- Exit with `exitFailure` on `AlreadyGeneratedByNewerHpack` or
`ExistingCabalFileWasModifiedManually` in `Hpack.printResult`

## Changes in 0.28.1
- GHC 8.4.1 compatibility

Expand Down
5 changes: 5 additions & 0 deletions src/Hpack.hs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,11 @@ printResult verbose r = do
OutputUnchanged -> resultCabalFile r ++ " is up-to-date"
AlreadyGeneratedByNewerHpack -> resultCabalFile r ++ " was generated with a newer version of hpack, please upgrade and try again."
ExistingCabalFileWasModifiedManually -> resultCabalFile r ++ " was modified manually, please use --force to overwrite."
case resultStatus r of
Generated -> return ()
OutputUnchanged -> return ()
AlreadyGeneratedByNewerHpack -> exitFailure
ExistingCabalFileWasModifiedManually -> exitFailure

printWarnings :: [String] -> IO ()
printWarnings = mapM_ $ Utf8.hPutStrLn stderr . ("WARNING: " ++)
Expand Down

0 comments on commit 8954510

Please sign in to comment.