Skip to content

Commit 166ef05

Browse files
committed
Do not assume that the build has been initialized
1 parent 6fb4641 commit 166ef05

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Diff for: ghcide/src/Development/IDE/Core/Shake.hs

+4-3
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ import Data.Aeson (toJSON)
154154
import qualified Data.ByteString.Char8 as BS8
155155
import Data.Coerce (coerce)
156156
import Data.Default
157-
import Data.Foldable (toList)
157+
import Data.Foldable (for_, toList)
158158
import Data.HashSet (HashSet)
159159
import qualified Data.HashSet as HSet
160160
import Data.String (fromString)
@@ -589,10 +589,11 @@ shakeSessionInit ide@IdeState{..} = do
589589
logDebug (ideLogger ide) "Shake session initialized"
590590

591591
shakeShut :: IdeState -> IO ()
592-
shakeShut IdeState{..} = withMVar shakeSession $ \runner -> do
592+
shakeShut IdeState{..} = do
593+
runner <- tryReadMVar shakeSession
593594
-- Shake gets unhappy if you try to close when there is a running
594595
-- request so we first abort that.
595-
void $ cancelShakeSession runner
596+
for_ runner cancelShakeSession
596597
void $ shakeDatabaseProfile shakeDb
597598
shakeClose
598599
progressStop $ progress shakeExtras

0 commit comments

Comments
 (0)