From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id B2F60138350 for ; Thu, 30 Apr 2020 20:30:00 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id F2044E09B5; Thu, 30 Apr 2020 20:29:59 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id DD30FE09B5 for ; Thu, 30 Apr 2020 20:29:59 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id F1FB634F086 for ; Thu, 30 Apr 2020 20:29:58 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id A711C1DD for ; Thu, 30 Apr 2020 20:29:57 +0000 (UTC) From: "Robin H. Johnson" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Robin H. Johnson" Message-ID: <1588278578.8a60a36dfca344e002faad387f58b01b09cafa22.robbat2@gentoo> Subject: [gentoo-commits] proj/gentoo-mirrorstats:master commit in: / X-VCS-Repository: proj/gentoo-mirrorstats X-VCS-Files: probe-mirmon X-VCS-Directories: / X-VCS-Committer: robbat2 X-VCS-Committer-Name: Robin H. Johnson X-VCS-Revision: 8a60a36dfca344e002faad387f58b01b09cafa22 X-VCS-Branch: master Date: Thu, 30 Apr 2020 20:29:57 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 6c708c53-5c52-4913-b238-eb38b8307b5b X-Archives-Hash: 8e25466f5232a5b32da0e70142d41cd8 commit: 8a60a36dfca344e002faad387f58b01b09cafa22 Author: Robin H. Johnson gentoo org> AuthorDate: Thu Apr 30 20:29:38 2020 +0000 Commit: Robin H. Johnson gentoo org> CommitDate: Thu Apr 30 20:29:38 2020 +0000 URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=8a60a36d probe-mirmon: make even less stderr Signed-off-by: Robin H. Johnson gentoo.org> probe-mirmon | 11 +++++++++-- 1 file 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 {