@@ -280,12 +280,12 @@ alterRouteTo uri stdout = do
281-- | Handle stdout of `ob run`: check that the frontend and backend servers are started correctly
281-- | Handle stdout of `ob run`: check that the frontend and backend servers are started correctly
282handleObRunStdout :: HTTP.Manager -> Handle -> Sh Text
282handleObRunStdout :: HTTP.Manager -> Handle -> Sh Text
283−handleObRunStdout httpManager stdout = flip fix ObRunState_Init $ \loop state -> do
283+handleObRunStdout httpManager stdout = flip fix (ObRunState_Init, []) $ \loop (state, msgs) -> do
284 liftIO (T.hGetLine stdout) >>= \t -> case state of
284 liftIO (T.hGetLine stdout) >>= \t -> case state of
285 ObRunState_Init
285 ObRunState_Init
286− | "Running test..." `T.isPrefixOf` t -> loop ObRunState_BackendStarted
286+ | "Running test..." `T.isPrefixOf` t -> loop (ObRunState_BackendStarted, msgs)
287 ObRunState_Startup
287 ObRunState_Startup
288− | t == "backend stopped; make a change to your code to reload" -> loop ObRunState_Startup
288+ | t == "backend stopped; make a change to your code to reload" -> loop (ObRunState_Startup, msgs)
289 -- | Just port <- "Backend running on port " `T.stripPrefix` t -> loop $ ObRunState_BackendStarted port
289 -- | Just port <- "Backend running on port " `T.stripPrefix` t -> loop $ ObRunState_BackendStarted port
290 | not (T.null t) -> errorExit $ "Startup: " <> t -- If theres any other output here, startup failed
290 | not (T.null t) -> errorExit $ "Startup: " <> t -- If theres any other output here, startup failed
291 ObRunState_BackendStarted
291 ObRunState_BackendStarted
@@ -293,7 +293,8 @@ handleObRunStdout httpManager stdout = flip fix ObRunState_Init $ \loop state ->
293 obRunCheck httpManager stdout uri
293 obRunCheck httpManager stdout uri
295 | not (T.null t) -> errorExit $ "Started: " <> t -- If theres any other output here, startup failed
295 | not (T.null t) -> errorExit $ "Started: " <> t -- If theres any other output here, startup failed
296+ _ | "Failed" `T.isPrefixOf` t -> errorExit $ "ob run failed: " <> T.unlines (reverse $ t : msgs)
296− _ -> loop state
297+ | otherwise -> loop (state, t : msgs)
298-- | Make requests to frontend/backend servers to check they are working properly
299-- | Make requests to frontend/backend servers to check they are working properly
299obRunCheck :: HTTP.Manager -> Handle -> Text -> Sh ()
300obRunCheck :: HTTP.Manager -> Handle -> Text -> Sh ()