Skip to content

SIGINT is not handled in forked process

If haskell program is forked in a toplevel hander that sends UserInterrupt in the main thread doesn't work, because Thread 1 doesn't exists in forked program, so that action is noop.

Minimal example:

import Control.Concurrent
import Control.Exception
import System.Posix

main = do
  pid <- forkProcess $ do
           handle (\UserInterrupt{} -> putStrLn "caught")
                  $ threadDelay 2000000
  signalProcess sigINT pid
  threadDelay 2000000

Expected result: "caught" printed to stdout. Actual result: nothing is printed.

Trac metadata
Trac field Value
Version 8.0.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Runtime System
Test case
Differential revisions
BlockedBy
Related
Blocking
CC simonmar
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information