From e3e9ebdaaf2c2f8192fc003f1857979f933b9a8b Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 25 Jan 2020 04:44:59 +0000 Subject: init: use Import::run_die instead of system() 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(-) (limited to 'script/public-inbox-init') 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 -- cgit v1.2.3-24-ge0c7