From 07a721fd777e384cf71d6eb07cd8c33bdf24e139 Mon Sep 17 00:00:00 2001 From: Jasper Van der Jeugt Date: Thu, 15 Nov 2012 10:24:46 +0100 Subject: Return proper exit status code Closes #94 Conflicts: src/Hakyll/Core/Run.hs --- src/Hakyll/Core/Runtime.hs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/Hakyll/Core/Runtime.hs b/src/Hakyll/Core/Runtime.hs index 23c24b1..a66e4b5 100644 --- a/src/Hakyll/Core/Runtime.hs +++ b/src/Hakyll/Core/Runtime.hs @@ -17,6 +17,7 @@ import qualified Data.Map as M import Data.Monoid (mempty) import Data.Set (Set) import qualified Data.Set as S +import System.Exit (ExitCode (..), exitWith) import System.FilePath (()) @@ -76,12 +77,15 @@ run configuration rules = do -- Run the program and fetch the resulting state result <- runErrorT $ runRWST build read' state case result of - Left e -> Logger.error logger e - Right (_, s, _) -> Store.set store factsKey $ runtimeFacts s - - -- Flush and return - Logger.flush logger - return ruleSet + Left e -> do + Logger.error logger e + Logger.flush logger + exitWith $ ExitFailure 1 + + Right (_, s, _) -> do + Store.set store factsKey $ runtimeFacts s + Logger.flush logger + return ruleSet where factsKey = ["Hakyll.Core.Runtime.run", "facts"] -- cgit v1.2.3