summaryrefslogtreecommitdiff
path: root/src/GF/System/UseSignal.hs
diff options
context:
space:
mode:
authorbringert <bringert@cs.chalmers.se>2006-06-15 01:41:18 +0000
committerbringert <bringert@cs.chalmers.se>2006-06-15 01:41:18 +0000
commitafac97b82181e2db14226d854761e53c66d98094 (patch)
treea3c61f6b04359f4ce0289bd4ba0863467cc2ea66 /src/GF/System/UseSignal.hs
parent3efba2f5cc795bd4bbf65224d2c20ce92f6f4a5f (diff)
Block SIGINT while running gfInteract, as suggested by Peter.
Diffstat (limited to 'src/GF/System/UseSignal.hs')
-rw-r--r--src/GF/System/UseSignal.hs8
1 files changed, 8 insertions, 0 deletions
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