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/TestCommon.pm | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'lib/PublicInbox/TestCommon.pm') diff --git a/lib/PublicInbox/TestCommon.pm b/lib/PublicInbox/TestCommon.pm index 7b628769..2c38500c 100644 --- a/lib/PublicInbox/TestCommon.pm +++ b/lib/PublicInbox/TestCommon.pm @@ -367,11 +367,7 @@ sub run_script ($;$$) { $cmd->[0] = File::Spec->rel2abs($cmd->[0]); $spawn_opt->{'-C'} = $d; } - my $pid = PublicInbox::Spawn::spawn($cmd, $env, $spawn_opt); - if (defined $pid) { - my $r = waitpid($pid, 0) // die "waitpid: $!"; - $r == $pid or die "waitpid: expected $pid, got $r"; - } + PublicInbox::Spawn::run_wait($cmd, $env, $spawn_opt); } else { # localize and run everything in the same process: # note: "local *STDIN = *STDIN;" and so forth did not work in # old versions of perl -- cgit v1.2.3-24-ge0c7