summaryrefslogtreecommitdiffstats
path: root/script
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2017-04-02 14:41:01 +0200
committerFlorian Pritz <bluewind@xinu.at>2017-04-02 22:31:49 +0200
commit59147c210c99f056176228c3eef432a90ca690bf (patch)
tree0babd2b4ee953c062ba8c2b478a66992897f4c1f /script
parent87e3939bb04256b441f3e3e2e903abf299511719 (diff)
downloadApp-BorgRestore-59147c210c99f056176228c3eef432a90ca690bf.tar.gz
App-BorgRestore-59147c210c99f056176228c3eef432a90ca690bf.tar.xz
Log die() and warn() calls
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'script')
-rwxr-xr-xscript/borg-restore.pl14
1 files changed, 14 insertions, 0 deletions
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(.*));