hie-core exe: initDynLinker (#2555)

The hie-core tests are flaky in stack. They can fail with the following
error message

```
hie-core: panic! (the 'impossible' happened)\n  (GHC version 8.6.5 for x86_64-unknown-linux):
        Dynamic linker not initialised

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug
```

Explicitly initializing the dynamic linker at session startup should
avoid this issue.
This commit is contained in:
Andreas Herrmann 2019-08-15 15:27:26 +02:00 committed by Gary Verhaegen
parent f8985134db
commit bf7fea4f1d

View File

@ -25,6 +25,7 @@ import Development.IDE.Types.Logger
import qualified Data.Text as T
import qualified Data.Text.IO as T
import Language.Haskell.LSP.Messages
import Linker
import Development.IDE.LSP.LanguageServer
import System.Directory.Extra as IO
import System.Environment
@ -125,6 +126,9 @@ showEvent lock (EventFileDiagnostics (toNormalizedFilePath -> file) diags) =
showEvent lock e = withLock lock $ print e
newSession' :: Cradle -> IO HscEnv
newSession' cradle = getLibdir >>= \libdir -> runGhc (Just libdir) $ do
initializeFlagsWithCradle "" cradle
getSession
newSession' cradle = getLibdir >>= \libdir -> do
env <- runGhc (Just libdir) $ do
initializeFlagsWithCradle "" cradle
getSession
initDynLinker env
pure env