diff options
author | Simonas Kazlauskas <git@kazlauskas.me> | 2013-03-31 14:47:47 +0300 |
---|---|---|
committer | Simonas Kazlauskas <git@kazlauskas.me> | 2013-03-31 14:47:47 +0300 |
commit | 259190e30bb9136aef5b06546d47306edc2ad3ee (patch) | |
tree | 2c97896584e2404ae5d9238e9b7fdea2701ee812 /src/Hakyll/Commands.hs | |
parent | bcc0ef828ec6f0abd8f397e6c04335e2c37256c9 (diff) | |
download | hakyll-259190e30bb9136aef5b06546d47306edc2ad3ee.tar.gz |
Refine code
This patch includes several smaller changes, namely:
1. We don't use result of `update` function and likely never will, so
don't bother generating it.
2. Rename watch function to better reflect what it does.
3. Never exit preview server in case of failed update.
Diffstat (limited to 'src/Hakyll/Commands.hs')
-rw-r--r-- | src/Hakyll/Commands.hs | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/src/Hakyll/Commands.hs b/src/Hakyll/Commands.hs index 140e0d9..700dda5 100644 --- a/src/Hakyll/Commands.hs +++ b/src/Hakyll/Commands.hs @@ -13,7 +13,7 @@ module Hakyll.Commands -------------------------------------------------------------------------------- -import System.Exit (ExitCode (ExitSuccess), exitWith) +import System.Exit (exitWith) -------------------------------------------------------------------------------- @@ -27,9 +27,6 @@ import Hakyll.Core.Util.File -------------------------------------------------------------------------------- #ifdef PREVIEW_SERVER -import qualified Data.Set as S -import Hakyll.Core.Identifier -import Hakyll.Core.Rules.Internal import Hakyll.Preview.Poll import Hakyll.Preview.Server #endif @@ -67,15 +64,12 @@ clean conf = do preview :: Configuration -> Verbosity -> Rules a -> Int -> IO () #ifdef PREVIEW_SERVER preview conf verbosity rules port = do - previewPoll conf update + watchUpdates conf update server conf port where update = do - (exitCode, ruleSet) <- run conf verbosity rules - case exitCode of - ExitSuccess -> return $ map toFilePath $ S.toList $ - rulesResources ruleSet - _ -> exitWith exitCode + _ <- run conf verbosity rules + return () #else preview _ _ _ _ = previewServerDisabled #endif |