From 72ccceeb02542dda09b8a641c2bd17dd74440cc2 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 26 Sep 2023 07:44:40 +0000 Subject: spawn: add run_wait to simplify spawn+waitpid use It's basically the `system' perlop with support for env overrides, redirects, chdir, rlimits, and setpgid support. --- lib/PublicInbox/Fetch.pm | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'lib/PublicInbox/Fetch.pm') diff --git a/lib/PublicInbox/Fetch.pm b/lib/PublicInbox/Fetch.pm index 8f3a87e2..6e9b1e94 100644 --- a/lib/PublicInbox/Fetch.pm +++ b/lib/PublicInbox/Fetch.pm @@ -5,7 +5,7 @@ package PublicInbox::Fetch; use v5.12; use parent qw(PublicInbox::IPC); use URI (); -use PublicInbox::Spawn qw(popen_rd run_die spawn); +use PublicInbox::Spawn qw(popen_rd run_wait); use PublicInbox::Admin; use PublicInbox::LEI; use PublicInbox::LeiCurl; @@ -133,9 +133,8 @@ sub do_fetch { # main entry point warn "W: $edir missing remote.*.url\n"; my $o = { -C => $edir }; $o->{1} = $o->{2} = $lei->{2}; - my $pid = spawn([qw(git config -l)], undef, $o); - waitpid($pid, 0); - $lei->child_error($?) if $?; + run_wait([qw(git config -l)], undef, $o) and + $lei->child_error($?); } } @epochs = grep { !$skip->{$_} } @epochs if $skip; -- cgit v1.2.3-24-ge0c7