on master help sign in
Use explicit error code in `check` mode
commit42c91987bf391be4ca6e5f5ed309cedeedf10269 authorBasile Henry <bjm.henry@gmail.com> dateMon 17 Jun 2019, 00:21 (7 years ago) parentb2024bf
2 files changed+6−3
app/Main.hs+5−2 src/Ormolu/Exception.hs+1−1
app/Main.hs+5−2
@@ -12,7 +12,7 @@ import Development.GitRev
1212import Options.Applicative
1313import Ormolu
1414import Paths_ormolu (version)
15−import System.Exit (exitFailure)
15+import System.Exit (ExitCode (..), exitWith)
1616import qualified Data.Text.IO as TIO
1717import qualified Data.Yaml as Yaml
1818
@@ -34,7 +34,10 @@ main = withPrettyOrmoluExceptions $ do
3434 TIO.writeFile optInputFile r
3535 Check -> do
3636 r' <- TIO.readFile optInputFile
37− when (r /= r') exitFailure
37+ when (r /= r') . exitWith $
38+ ExitFailure 100 -- 100 is different to all the other exit code that
39+ -- are emitted either from an 'OrmoluException' or
40+ -- from 'error' and 'notImplemented'.
3841
3942----------------------------------------------------------------------------
4043-- Command line options parsing.
src/Ormolu/Exception.hs+1−1
@@ -10,7 +10,7 @@ where
1010
1111import Control.Exception
1212import Data.Text (Text)
13−import System.Exit (ExitCode (ExitFailure), exitWith)
13+import System.Exit (ExitCode (..), exitWith)
1414import System.IO
1515import qualified GHC
1616import qualified Outputable as GHC