From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id E3A001FD58 for ; Sat, 25 Jan 2020 04:45:12 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 11/22] init: use Import::run_die instead of system() Date: Sat, 25 Jan 2020 04:44:59 +0000 Message-Id: <20200125044510.13769-12-e@yhbt.net> In-Reply-To: <20200125044510.13769-1-e@yhbt.net> References: <20200125044510.13769-1-e@yhbt.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: We already load PublicInbox::Import via PublicInbox::InboxWritable, so it's not an extra module to load. This can give us a slight speedup in tests. --- script/public-inbox-init | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/script/public-inbox-init b/script/public-inbox-init index 34c93b47..6221871e 100755 --- a/script/public-inbox-init +++ b/script/public-inbox-init @@ -16,6 +16,7 @@ use PublicInbox::Admin; PublicInbox::Admin::require_or_die('-base'); use PublicInbox::Config; use PublicInbox::InboxWritable; +use PublicInbox::Import; use File::Temp qw/tempfile/; use PublicInbox::Lock; use File::Basename qw/dirname/; @@ -23,7 +24,6 @@ use File::Path qw/mkpath/; use Fcntl qw(:DEFAULT); use Cwd qw/abs_path/; -sub x { system(@_) and die join(' ', @_). " failed: $?\n" } my $version = undef; my $indexlevel = undef; my $skip_epoch; @@ -151,13 +151,13 @@ umask(0077) if defined $perm; foreach my $addr (@address) { next if $seen{lc($addr)}; - x(@x, "--add", "$pfx.address", $addr); + PublicInbox::Import::run_die([@x, "--add", "$pfx.address", $addr]); } -x(@x, "$pfx.url", $http_url); -x(@x, "$pfx.inboxdir", $inboxdir); +PublicInbox::Import::run_die([@x, "$pfx.url", $http_url]); +PublicInbox::Import::run_die([@x, "$pfx.inboxdir", $inboxdir]); if (defined($indexlevel)) { - x(@x, "$pfx.indexlevel", $indexlevel); + PublicInbox::Import::run_die([@x, "$pfx.indexlevel", $indexlevel]); } # needed for git prior to v2.1.0