summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xprobe-mirmon11
1 files changed, 9 insertions, 2 deletions
diff --git a/probe-mirmon b/probe-mirmon
index 6d67fbf..1e10ef1 100755
--- a/probe-mirmon
+++ b/probe-mirmon
@@ -22,6 +22,7 @@ use warnings;
use Date::Parse (); # dev-perl/TimeDate
use File::Tempdir; # dev-perl/File-Tempdir
use WWW::Curl::Easy;
+use Capture::Tiny qw/capture/;
sub main {
my ( $timeout, $url ) = @_;
@@ -84,9 +85,15 @@ sub handle_rsync {
$file =~ s/\W/_/g; # translate all non-letters to _
- if ( my $fail = system '/usr/bin/rsync', qw( -q --no-motd --timeout ), $timeout, $url, "$dir/$file", '2>/dev/null' ) {
+ # https://stackoverflow.com/a/6331618/1583179
+ my $ret;
+ my ($stdout, $stderr) = capture {
+ $ret = system '/usr/bin/rsync', qw( -q --no-motd --timeout ), $timeout, $url, "$dir/$file";
+ };
+ if ($ret!=0) {
#warn "rsync failed, exit code $fail, $! $? $@\n";
- exit $fail;
+ #exit $ret;
+ exit 800;
}
open my $fh, '<', "$dir/$file" or do {