summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRobert <rob@vllmrt.net>2019-11-27 14:53:08 +0100
committerJasper Van der Jeugt <m@jaspervdj.be>2019-11-27 07:53:08 -0600
commite7f0df00098af7ccdcea2124ec1758cbbde65747 (patch)
tree2d5e485336e56b1ca297117745ae208753839c4f /lib
parentf2778e12046eb5f5eb4d377669b94b13dffc24fb (diff)
downloadhakyll-e7f0df00098af7ccdcea2124ec1758cbbde65747.tar.gz
Flush log before starting web server
This fixes out of order console messaging in the case of errors binding to the configured address, though the message order is still a bit weird. Before: $ stack exec site watch Initialising... Creating store... site: Network.Socket.bind: resource busy (Address already in use) Creating provider... Listening on http://127.0.0.1:8000 After: $ stack exec site watch Listening on http://127.0.0.1:8000 Initialising... Creating store... Creating provider... site: Network.Socket.bind: resource busy (Address already in use)
Diffstat (limited to 'lib')
-rw-r--r--lib/Hakyll/Preview/Server.hs1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/Hakyll/Preview/Server.hs b/lib/Hakyll/Preview/Server.hs
index a84016a..828a1d2 100644
--- a/lib/Hakyll/Preview/Server.hs
+++ b/lib/Hakyll/Preview/Server.hs
@@ -24,6 +24,7 @@ staticServer :: Logger -- ^ Logger
-> IO () -- ^ Blocks forever
staticServer logger directory host port = do
Logger.header logger $ "Listening on http://" ++ host ++ ":" ++ show port
+ Logger.flush logger -- ensure this line is logged before Warp errors
Warp.runSettings warpSettings $
Static.staticApp (Static.defaultFileServerSettings directory)
where