getConfig runs "cabal configure" first if setup-config is invalid.

This commit is contained in:
Kazu Yamamoto
2014-09-23 21:28:03 +09:00
parent 7db266c22d
commit c4929c54af
7 changed files with 91 additions and 109 deletions

View File

@@ -91,7 +91,10 @@ run opt ref = flip E.catches handlers $ do
prepareAutogen cradle0
-- Asynchronous db loading starts here.
symdbreq <- newSymDbReq opt
(res, _) <- runGhcModT opt $ getWorld >>= loop symdbreq ref
(res, _) <- runGhcModT opt $ do
crdl <- cradle
world <- liftIO $ getCurrentWorld crdl
loop symdbreq ref world
case res of
Right () -> return ()
Left (GMECabalConfigure msg) -> do
@@ -126,7 +129,8 @@ loop symdbreq ref world = do
-- blocking
cmdArg <- liftIO $ getCommand ref
-- after blocking, we need to see if the world has changed.
changed <- isChanged world
crdl <- cradle
changed <- liftIO $ isWorldChanged world crdl
when changed $ do
liftIO $ ungetCommand ref cmdArg
E.throw Restart