diff --git a/yesod-bin/Devel.hs b/yesod-bin/Devel.hs index bc51c8f9..3cf90d8b 100644 --- a/yesod-bin/Devel.hs +++ b/yesod-bin/Devel.hs @@ -7,6 +7,7 @@ module Devel , defaultDevelOpts ) where +import Paths_yesod_bin import qualified Distribution.Compiler as D import qualified Distribution.ModuleName as D @@ -28,6 +29,7 @@ import Control.Monad.IO.Class (liftIO) import Control.Monad.Trans.State (evalStateT, get) import qualified Data.IORef as I +import qualified Data.ByteString.Lazy as LB import Data.Char (isNumber, isUpper) import qualified Data.List as L import qualified Data.Map as Map @@ -144,12 +146,15 @@ reverseProxy opts iappPort = do putStrLn "Restarting reverse proxy" loop `Ex.onException` exitFailure where - onExc _ _ = return $ responseLBS + onExc _ _ = do + refreshing <- liftIO $ getDataFileName "refreshing.html" + html <- liftIO $ LB.readFile refreshing + return $ responseLBS status200 [ ("content-type", "text/html") , ("Refresh", "1") ] - "

App not ready, please refresh

" + html checkPort :: Int -> IO Bool checkPort p = do @@ -444,4 +449,3 @@ waitForProcess' pid = go -- | wait for process started by @createProcess@, return True for ExitSuccess checkExit :: (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle) -> IO Bool checkExit (_,_,_,h) = (==ExitSuccess) <$> waitForProcess' h - diff --git a/yesod-bin/refreshing.html b/yesod-bin/refreshing.html new file mode 100644 index 00000000..316c5cca --- /dev/null +++ b/yesod-bin/refreshing.html @@ -0,0 +1,72 @@ + + + + + Refreshing - Yesod devel + + + +
+
Yesod Devel
+

The application isn’t built

+

We’ll keep trying to refresh every second

+
+

Meanwhile, here are some motivational messages:

+ +
+ +
+ + diff --git a/yesod-bin/yesod-bin.cabal b/yesod-bin/yesod-bin.cabal index d6a49dc3..9919c917 100644 --- a/yesod-bin/yesod-bin.cabal +++ b/yesod-bin/yesod-bin.cabal @@ -11,6 +11,7 @@ stability: Stable cabal-version: >= 1.6 build-type: Simple homepage: http://www.yesodweb.com/ +data-files: refreshing.html extra-source-files: input/*.cg