From afac97b82181e2db14226d854761e53c66d98094 Mon Sep 17 00:00:00 2001 From: bringert Date: Thu, 15 Jun 2006 01:41:18 +0000 Subject: Block SIGINT while running gfInteract, as suggested by Peter. --- src/GF/System/UseSignal.hs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/GF/System/UseSignal.hs') diff --git a/src/GF/System/UseSignal.hs b/src/GF/System/UseSignal.hs index 8f3874711..5e6d81237 100644 --- a/src/GF/System/UseSignal.hs +++ b/src/GF/System/UseSignal.hs @@ -48,3 +48,11 @@ runInterruptibly a = -- the computation fails or not. runInterruptibly_ :: IO () -> IO () runInterruptibly_ = fmap (either (const ()) id) . runInterruptibly + +-- | Run an action with SIGINT blocked. +blockInterrupt :: IO a -> IO a +blockInterrupt a = + do oldH <- installHandler sigINT Ignore Nothing + x <- a + installHandler sigINT oldH Nothing + return x -- cgit v1.2.3