on master help sign in
ob run: display error when backend throws
commit8b8cd91e12df10e85f3230d28ab414b158ecaa5f authorLuigy Leon <luigy@outlook.com> dateWed 9 May 2018, 12:42 (8 years ago) parent4abf6b7
1 file changed+5−3
lib/command/src/Obelisk/Command/Run.hs+5−3
lib/command/src/Obelisk/Command/Run.hs+5−3
@@ -37,14 +37,16 @@ run = do
3737 let dotGhci = unlines
3838 [ ":set args --quiet --port " <> show freePort
3939 , ":set -i" <> intercalate ":" (mconcat hsSrcDirs)
40+ , ":set -XScopedTypeVariables"
4041 , ":add Backend Frontend"
41− , ":module + Control.Concurrent Obelisk.Widget.Run Frontend Backend"
42+ , ":module + System.IO Control.Exception Control.Concurrent Obelisk.Widget.Run Frontend Backend"
4243 ]
4344 testCmd = unlines
44− [ "backendId <- forkIO backend"
45+ [ "let handleBackendErr (_ :: SomeException) = hPutStrLn stderr \"backend stopped; make a change to your code to reload\""
46+ , "backendTid <- forkIO $ handle handleBackendErr backend"
4547 , "let conf = defRunConfig { _runConfig_redirectPort = " <> show freePort <> "}"
4648 , "runWidget conf frontend"
47− , "killThread backendId"
49+ , "killThread backendTid"
4850 ]
4951 withSystemTempDirectory "ob-ghci" $ \fp -> do
5052 let dotGhciPath = fp </> ".ghci"