From e7f0df00098af7ccdcea2124ec1758cbbde65747 Mon Sep 17 00:00:00 2001 From: Robert Date: Wed, 27 Nov 2019 14:53:08 +0100 Subject: 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) --- lib/Hakyll/Preview/Server.hs | 1 + 1 file changed, 1 insertion(+) (limited to 'lib') 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 -- cgit v1.2.3