Skip to content

Commit 53ab0d5

Browse files
committed
use try takeMVar
1 parent abf5538 commit 53ab0d5

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

ghcide/src/Development/IDE/Core/Shake.hs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -725,14 +725,14 @@ shakeSessionInit recorder ide@IdeState{..} = do
725725
logWith recorder Debug LogSessionInitialised
726726

727727
shakeShut :: IdeState -> IO ()
728-
shakeShut IdeState{..} =
729-
withMVar shakeSession $ \ runner -> do
730-
-- Shake gets unhappy if you try to close when there is a running
731-
-- request so we first abort that.
732-
cancelShakeSession runner
733-
void $ shakeDatabaseProfile shakeDb
734-
progressStop $ progress shakeExtras
735-
stopMonitoring
728+
shakeShut IdeState{..} = do
729+
runner <- tryTakeMVar shakeSession
730+
-- Shake gets unhappy if you try to close when there is a running
731+
-- request so we first abort that.
732+
for_ runner cancelShakeSession
733+
void $ shakeDatabaseProfile shakeDb
734+
progressStop $ progress shakeExtras
735+
stopMonitoring
736736

737737

738738
-- | This is a variant of withMVar where the first argument is run unmasked and if it throws

0 commit comments

Comments
 (0)