Skip Menu |

This queue is for tickets about the IO-Prompt CPAN distribution.

Report information
The Basics
Id: 38014
Status: new
Priority: 0/
Queue: IO-Prompt

People
Owner: Nobody in particular
Requestors: roman.yepishev [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: v0.99.4
Fixed in: v0.99.4



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.