diff options
Diffstat (limited to 'iurt2')
-rwxr-xr-x | iurt2 | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -52,6 +52,28 @@ use Mkcd::Commandline qw(parseCommandLine usage); use MDK::Common; use Filesys::Df qw(df); + +sub bug_handler { + my ($error, $is_signal) = @_; + + # exceptions in eval are OK: + return if $error && $^S && !$is_signal; + + # we want the full backtrace: + $error .= "\n" if $is_signal; + $error .= backtrace() if $error; + + warn "We got an uncatched exception:\n$error\n"; + exit(1); +} + +$SIG{SEGV} = sub { bug_handler(@_, 1) }; +$SIG{__DIE__} = \&bug_handler; +$SIG{TERM} = sub { + warn "Got KILLED by SIGTERM"; + exit(1); + }; + my $program_name = 'iurt2'; my $VERSION = '0.6.2'; # sessing parameters |