@@ -190,6 +190,9 @@ import System.Time.Extra
190190import UnliftIO (MonadUnliftIO (withRunInIO ),
191191 newIORef , readIORef )
192192
193+ #if !MIN_VERSION_ghc(9,9,0)
194+ import Data.Foldable (foldl' )
195+ #endif
193196
194197
195198data Log
@@ -341,7 +344,8 @@ data ShakeExtras = ShakeExtras
341344 ,ideTesting :: IdeTesting
342345 -- ^ Whether to enable additional lsp messages used by the test suite for checking invariants
343346 ,restartShakeSession
344- :: VFSModified
347+ :: ShouldWait
348+ -> VFSModified
345349 -> String
346350 -> [DelayedAction () ]
347351 -> IO [Key ]
@@ -886,15 +890,21 @@ instance Semigroup ShakeRestartArgs where
886890-- | Restart the current 'ShakeSession' with the given system actions.
887891-- Any actions running in the current session will be aborted,
888892-- but actions added via 'shakeEnqueue' will be requeued.
889- shakeRestart :: ShakeControlQueue -> VFSModified -> String -> [DelayedAction () ] -> IO [Key ] -> IO ()
890- shakeRestart rts vfs reason acts ioActionBetweenShakeSession = do
891- waitMVar <- newEmptyMVar
892- -- submit at the head of the queue,
893- -- prefer restart request over any pending actions
894- void $ submitWorkAtHead rts $ Left $
895- toDyn $ ShakeRestartArgs vfs reason acts ioActionBetweenShakeSession rts 1 [waitMVar]
896- -- Wait until the restart is done
897- takeMVar waitMVar
893+ shakeRestart :: ShakeControlQueue -> ShouldWait -> VFSModified -> String -> [DelayedAction () ] -> IO [Key ] -> IO ()
894+ shakeRestart rts b vfs reason acts ioActionBetweenShakeSession = case b of
895+ ShouldWait ->
896+ do
897+ waitMVar <- newEmptyMVar
898+ -- submit at the head of the queue,
899+ -- prefer restart request over any pending actions
900+ void $ submitWorkAtHead rts $ Left $
901+ toDyn $ ShakeRestartArgs vfs reason acts ioActionBetweenShakeSession rts 1 [waitMVar]
902+ -- Wait until the restart is done
903+ takeMVar waitMVar
904+ ShouldNotWait ->
905+ void $ submitWorkAtHead rts $ Left $
906+ toDyn $ ShakeRestartArgs vfs reason acts ioActionBetweenShakeSession rts 1 []
907+
898908
899909dynShakeRestart :: Dynamic -> ShakeRestartArgs
900910dynShakeRestart dy = case fromDynamic dy of
0 commit comments