Subject: | SIGINT handler should not call exit() unconditionally |
When the code calls prompt() it has no control over interrupt signal.
IO::Prompt installs
local $SIG{INT} = sub { ReadMode 'restore', $IN; exit };
which can not be trapped by the caller. This might be good for simple
scripts where one should not care about how to handle interrupts in
their own code. But when one needs to trap harmful signals to prevent
long-running process from failing in the middle of operation such
solution becomes a bug.
I guess this should be at least somehow configurable, i.e.
$IO::Prompt::ExitOnSIGINT = 1 by default. When ExitOnSIGINT == 0, then
the current SIGINT handler is stored, local one restores the terminal
settings and calls the global one if it exists. Throwing the exception
may be reasonable as well.