[Haskell-cafe] control-c only caught once -- bug?

Donn Cave donn at avvanta.com
Sat Oct 29 18:36:37 CEST 2011

<brianjohnsonhaskellcafe at gmail.com> wrote:

> The second time I press control-c, it isn't caught -- the program exits
> instead.  Why?

I don't know why.  Same behavior on my platform (Haiku.)

While I imagine someone intimately acquainted with RTS signal handling
might be able to explain it, I think the real problem is that
Control.Exception.Catch isn't a real signal handler.  For example,
your program doesn't catch SIGHUP, or SIGALRM, or probably anything but
SIGINT.  The SIGINT handler looks like more of a quirk of the RTS, than
a feature whose behavior you should depend on in great detail.

I can use System.Posix.Signals.installHandler to catch <ctrl>C (SIGINT)
in a repeatable way, on MacOS X, so that's working as it should.  If you
want it to return control to the user interface, that's going to take
some work - for all I know, there may be some way to hook a signal handler
up with Control.Exception.catch.


More information about the Haskell-Cafe mailing list