summaryrefslogtreecommitdiffhomepage
path: root/src/Main.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Main.hs')
-rw-r--r--src/Main.hs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/Main.hs b/src/Main.hs
index 9a3a2e8..64a4ea4 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -38,18 +38,18 @@ import System.Exit
import System.Environment
import System.FilePath ((</>))
import System.Posix.Files
-import Control.Exception
import Control.Concurrent.Async (Async, cancel)
+import Control.Exception (bracket)
import Control.Monad (unless)
import Text.Read (readMaybe)
-import Signal (setupSignalHandler)
+import Signal (setupSignalHandler, withDeferSignals)
-- $main
-- | The main entry point
main :: IO ()
-main = do
+main = withDeferSignals $ do
initThreads
d <- openDisplay ""
args <- getArgs
@@ -77,6 +77,7 @@ main = do
cleanupThreads :: [[([Async ()], a)]] -> IO ()
cleanupThreads vars =
+ -- putStrLn "In cleanupThreads"
for_ (concat vars) $ \(asyncs, _) ->
for_ asyncs cancel