1
1
mirror of https://github.com/tweag/ormolu.git synced 2024-09-11 13:16:13 +03:00

Use explicit error code in check mode

This commit is contained in:
Basile Henry 2019-06-17 00:21:43 +02:00 committed by Mark Karpov
parent b2024bfc3d
commit 42c91987bf
2 changed files with 6 additions and 3 deletions

View File

@ -12,7 +12,7 @@ import Development.GitRev
import Options.Applicative
import Ormolu
import Paths_ormolu (version)
import System.Exit (exitFailure)
import System.Exit (ExitCode (..), exitWith)
import qualified Data.Text.IO as TIO
import qualified Data.Yaml as Yaml
@ -34,7 +34,10 @@ main = withPrettyOrmoluExceptions $ do
TIO.writeFile optInputFile r
Check -> do
r' <- TIO.readFile optInputFile
when (r /= r') exitFailure
when (r /= r') . exitWith $
ExitFailure 100 -- 100 is different to all the other exit code that
-- are emitted either from an 'OrmoluException' or
-- from 'error' and 'notImplemented'.
----------------------------------------------------------------------------
-- Command line options parsing.

View File

@ -10,7 +10,7 @@ where
import Control.Exception
import Data.Text (Text)
import System.Exit (ExitCode (ExitFailure), exitWith)
import System.Exit (ExitCode (..), exitWith)
import System.IO
import qualified GHC
import qualified Outputable as GHC