From 59147c210c99f056176228c3eef432a90ca690bf Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Sun, 2 Apr 2017 14:41:01 +0200 Subject: Log die() and warn() calls Signed-off-by: Florian Pritz --- script/borg-restore.pl | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'script') diff --git a/script/borg-restore.pl b/script/borg-restore.pl index aa7117c..5a7d8f4 100755 --- a/script/borg-restore.pl +++ b/script/borg-restore.pl @@ -214,6 +214,20 @@ sub main { Log::Log4perl::init( \$conf ); Log::Any::Adapter->set('Log4perl'); + $SIG{__WARN__} = sub { + local $Log::Log4perl::caller_depth = + $Log::Log4perl::caller_depth + 1; + Log::Log4perl->get_logger()->warn(@_); + }; + + $SIG{__DIE__} = sub { + # ignore eval blocks + return if($^S); + local $Log::Log4perl::caller_depth = + $Log::Log4perl::caller_depth + 1; + Log::Log4perl->get_logger()->logdie(@_); + }; + my %opts; # untaint PATH because we only expect this to run as root $ENV{PATH} = App::BorgRestore::Helper::untaint($ENV{PATH}, qr(.*)); -- cgit v1.2.3-24-g4f1b