From 007261536b8b5daf1e3cac24eeeb160c6d572c85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Wed, 1 Apr 2026 20:57:51 +0200 Subject: Set exception handler before returning task --- src/Job.hs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/Job.hs') diff --git a/src/Job.hs b/src/Job.hs index 649833a..740a9f8 100644 --- a/src/Job.hs +++ b/src/Job.hs @@ -259,8 +259,10 @@ runJobs mngr@JobManager {..} tout jobs rerun = do atomically $ writeTVar taskStatus status outputJobFinishedEvent tout taskJob status + handlerInstalled <- newEmptyMVar taskThread <- forkIO $ do handle handler $ do + putMVar handlerInstalled () res <- runExceptT $ do duplicate <- liftIO $ atomically $ do readTVar taskStatus >>= \case @@ -305,6 +307,7 @@ runJobs mngr@JobManager {..} tout jobs rerun = do atomically $ writeTVar taskStatus $ either id id res outputJobFinishedEvent tout taskJob $ either id id res + takeMVar handlerInstalled return Task {..} waitForRemainingTasks :: JobManager -> IO () -- cgit v1.2.3