From cbfa26eb1647b149f37f2d1639a6b6d47fa23acc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Gr=C3=B6ber?= Date: Fri, 14 Aug 2015 03:48:29 +0200 Subject: [PATCH] Make sure cabal-helper is ready before invoking dumpsym --- Language/Haskell/GhcMod/CabalHelper.hs | 9 +++++++++ Language/Haskell/GhcMod/Internal.hs | 2 ++ src/GHCMod.hs | 1 + 3 files changed, 12 insertions(+) diff --git a/Language/Haskell/GhcMod/CabalHelper.hs b/Language/Haskell/GhcMod/CabalHelper.hs index 36c82a1..006607b 100644 --- a/Language/Haskell/GhcMod/CabalHelper.hs +++ b/Language/Haskell/GhcMod/CabalHelper.hs @@ -20,6 +20,7 @@ module Language.Haskell.GhcMod.CabalHelper ( getComponents , getGhcMergedPkgOptions , getPackageDbStack + , prepareCabalHelper ) #endif where @@ -126,6 +127,14 @@ getComponents = chCached Cached { , a == a' ] +prepareCabalHelper :: (IOish m, GmEnv m, GmLog m) => m () +prepareCabalHelper = do + crdl <- cradle + let projdir = cradleRootDir crdl + distdir = projdir "dist" + readProc <- gmReadProcess + liftIO $ prepare readProc projdir distdir + withCabal :: (IOish m, GmEnv m, GmLog m) => m a -> m a withCabal action = do crdl <- cradle diff --git a/Language/Haskell/GhcMod/Internal.hs b/Language/Haskell/GhcMod/Internal.hs index bb9fae7..143dc5f 100644 --- a/Language/Haskell/GhcMod/Internal.hs +++ b/Language/Haskell/GhcMod/Internal.hs @@ -52,6 +52,7 @@ module Language.Haskell.GhcMod.Internal ( , GmComponent(..) , GmComponentType(..) , GmModuleGraph(..) + , prepareCabalHelper ) where import GHC.Paths (libdir) @@ -65,6 +66,7 @@ import Language.Haskell.GhcMod.Monad import Language.Haskell.GhcMod.Types import Language.Haskell.GhcMod.Utils import Language.Haskell.GhcMod.World +import Language.Haskell.GhcMod.CabalHelper -- | Obtaining the directory for ghc system libraries. ghcLibDir :: FilePath diff --git a/src/GHCMod.hs b/src/GHCMod.hs index 57c914e..06156f9 100644 --- a/src/GHCMod.hs +++ b/src/GHCMod.hs @@ -371,6 +371,7 @@ globalCommands _ = Nothing legacyInteractive :: IOish m => GhcModT m () legacyInteractive = do opt <- options + prepareCabalHelper symdbreq <- liftIO $ newSymDbReq opt world <- getCurrentWorld legacyInteractiveLoop symdbreq world