X-Git-Url: http://git.lukelau.me/?p=lsp-test.git;a=blobdiff_plain;f=src%2FLanguage%2FHaskell%2FLSP%2FTest%2FSession.hs;h=700d9ccc84c233314f9c581bfd6bf8f810c8c1d5;hp=a153cba988890e08b5fe6f54e40d3a8cdfcbb377;hb=76034cba7ecf34ce9098d46f7e7bccea2b66c81f;hpb=a9cff941ac28ce31c8463b6bd84237c0eeee06ea diff --git a/src/Language/Haskell/LSP/Test/Session.hs b/src/Language/Haskell/LSP/Test/Session.hs index a153cba..700d9cc 100644 --- a/src/Language/Haskell/LSP/Test/Session.hs +++ b/src/Language/Haskell/LSP/Test/Session.hs @@ -201,9 +201,12 @@ runSessionWithHandles serverIn serverOut serverHandler config caps rootDir sessi messageChan <- newChan initRsp <- newEmptyMVar + mainThreadId <- myThreadId + let context = SessionContext serverIn absRootDir messageChan reqMap initRsp config caps initState = SessionState (IdInt 0) mempty mempty 0 False Nothing - launchServerHandler = forkIO $ void $ serverHandler serverOut context + launchServerHandler = forkIO $ catch (serverHandler serverOut context) + (throwTo mainThreadId :: SessionException -> IO ()) (result, _) <- bracket launchServerHandler killThread $ const $ runSession context initState session @@ -332,3 +335,4 @@ logMsg t msg = do | otherwise = Cyan showPretty = B.unpack . encodePretty +