@@ -75,7 +75,7 @@ module Development.IDE.Core.Shake(
7575 VFSModified (.. ), getClientConfigAction ,
7676 ) where
7777
78- import Control.Concurrent (takeMVar , withMVar )
78+ import Control.Concurrent (withMVar )
7979import Control.Concurrent.Async
8080import Control.Concurrent.STM
8181import Control.Concurrent.STM.Stats (atomicallyNamed )
@@ -729,17 +729,16 @@ shakeSessionInit recorder ide@IdeState{..} = do
729729
730730shakeShut :: Recorder (WithPriority Log ) -> IdeState -> IO ()
731731shakeShut recorder IdeState {.. } = do
732- res <- timeout 1 $ takeMVar shakeSession
732+ res <- timeout 1 $ withMVar shakeSession $ \ runner -> do
733+ -- Shake gets unhappy if you try to close when there is a running
734+ -- request so we first abort that.
735+ cancelShakeSession runner
736+ void $ shakeDatabaseProfile shakeDb
737+ progressStop $ progress shakeExtras
738+ stopMonitoring
733739 case res of
734- Just session -> do
735- -- Shake gets unhappy if you try to close when there is a running
736- -- request so we first abort that.
737- cancelShakeSession session
738- void $ shakeDatabaseProfile shakeDb
739- progressStop $ progress shakeExtras
740- stopMonitoring
741- case res of
742740 Nothing -> logWith recorder Error $ LogTimeOutShuttingDownWaitForSessionVar 1
741+ Just _ -> pure ()
743742
744743
745744-- | This is a variant of withMVar where the first argument is run unmasked and if it throws
0 commit comments