diff --git a/CHANGELOG.md b/CHANGELOG.md index 147a9d10..8fffee36 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/Hpack.hs b/src/Hpack.hs index f55920b2..3267ad92 100644 --- a/src/Hpack.hs +++ b/src/Hpack.hs @@ -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: " ++)