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

2011-10-30 Thread Donn Cave
Quoth Brian Johnson brianjohnsonhaskellc...@gmail.com, ... On further thought, there is something sensible here: the RTS might crash while trying to exit. I propose, for POSIX environments, the following change to SIGINT handling: * SIGINT is transformed into UserInterrupt during normal

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

2011-10-29 Thread Donn Cave
brianjohnsonhaskellc...@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

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

2011-10-29 Thread Brian Johnson
On Sat, Oct 29, 2011 at 9:36 AM, Donn Cave d...@avvanta.com wrote: 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 looked into this some more, and found that it is indeed a quirk of the RTS -- an apparently

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

2011-10-29 Thread Brian Johnson
On Sat, Oct 29, 2011 at 12:18 PM, Brian Johnson brianjohnsonhaskellc...@gmail.com wrote: From http://hackage.haskell.org/trac/ghc/wiki/Commentary/Rts/Signals: When the interrupt signal is received, the default behaviour of the runtime is to attempt to shut down the Haskell program gracefully.

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

2011-10-29 Thread Brandon Allbery
An interactive program that wants to handle interrupt itself should not rely on default signal behavior, because that has no idea where to stop (and I would argue that attempting to coerce interactive signals into exceptions within the program is not the right way to do things, because they're

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

2011-10-28 Thread Brian Johnson
Hi, The second time I press control-c, it isn't caught -- the program exits instead. Why? (The context is, I'm writing an interactive program where calculations may take a long time. Control-c during a calculation should return the user to a prompt. As things stand, this can only be done once

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

2011-10-28 Thread Rogan Creswick
On Fri, Oct 28, 2011 at 12:47 PM, Brian Johnson brianjohnsonhaskellc...@gmail.com wrote: Hi, The second time I press control-c, it isn't caught -- the program exits instead.  Why? Interesting -- this works as you want with runghc, but it works as you describe when compiled with ghc --make.

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

2011-10-28 Thread Giovanni Tirloni
On Fri, Oct 28, 2011 at 6:07 PM, Rogan Creswick cresw...@gmail.com wrote: On Fri, Oct 28, 2011 at 12:47 PM, Brian Johnson brianjohnsonhaskellc...@gmail.com wrote: Hi, The second time I press control-c, it isn't caught -- the program exits instead. Why? Interesting -- this works as you