btrbk: add signal handler for SIGINT, dumping transaction log

pull/57/head
Axel Burri 2015-10-20 20:17:31 +02:00
parent cea3781ed2
commit da86557b89
1 changed files with 7 additions and 0 deletions

7
btrbk
View File

@ -182,6 +182,13 @@ $SIG{__DIE__} = sub {
Carp::confess @_;
};
$SIG{INT} = sub {
print STDERR "\nERROR: Cought SIGINT, dumping transaction log:\n";
action("signal", status => "SIGINT");
print_formatted("transaction", \@transaction_log, output_format => "tlog", outfile => *STDERR);
exit 1;
};
sub VERSION_MESSAGE
{
print STDERR $version_info . "\n\n";