on master help sign in
Return proper exit status code
07a721fJasper Van der Jeugt
src/Hakyll/Core/Runtime.hs+10−6
@@ -17,6 +17,7 @@ import qualified Data.Map as M
17import Data.Monoid (mempty)
17import Data.Monoid (mempty)
18import Data.Set (Set)
18import Data.Set (Set)
19import qualified Data.Set as S
19import qualified Data.Set as S
20+import System.Exit (ExitCode (..), exitWith)
20import System.FilePath ((</>))
21import System.FilePath ((</>))
21
22
22
23
@@ -76,12 +77,15 @@ run configuration rules = do
76 -- Run the program and fetch the resulting state
77 -- Run the program and fetch the resulting state
77 result <- runErrorT $ runRWST build read' state
78 result <- runErrorT $ runRWST build read' state
78 case result of
79 case result of
80+ Left e -> do
79− Left e -> Logger.error logger e
81+ Logger.error logger e
82+ Logger.flush logger
83+ exitWith $ ExitFailure 1
84+
85+ Right (_, s, _) -> do
80− Right (_, s, _) -> Store.set store factsKey $ runtimeFacts s
86+ Store.set store factsKey $ runtimeFacts s
81−
82− -- Flush and return
83− Logger.flush logger
87+ Logger.flush logger
84− return ruleSet
88+ return ruleSet
85 where
89 where
86 factsKey = ["Hakyll.Core.Runtime.run", "facts"]
90 factsKey = ["Hakyll.Core.Runtime.run", "facts"]
87
91