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/LEI.pm | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'lib/PublicInbox/LEI.pm') diff --git a/lib/PublicInbox/LEI.pm b/lib/PublicInbox/LEI.pm index 432ae61e..2f8d7a96 100644 --- a/lib/PublicInbox/LEI.pm +++ b/lib/PublicInbox/LEI.pm @@ -18,7 +18,7 @@ use IO::Handle (); use Fcntl qw(SEEK_SET); use PublicInbox::Config; use PublicInbox::Syscall qw(EPOLLIN); -use PublicInbox::Spawn qw(spawn popen_rd); +use PublicInbox::Spawn qw(run_wait popen_rd); use PublicInbox::Lock; use PublicInbox::Eml; use PublicInbox::Import; @@ -905,8 +905,7 @@ sub _config { } my $cmd = $cfg->config_cmd(\%env, \%opt); push @$cmd, @file_arg, @argv; - waitpid(spawn($cmd, \%env, \%opt), 0); - $? == 0 ? 1 : ($err_ok ? undef : fail($self, $?)); + run_wait($cmd, \%env, \%opt) ? ($err_ok ? undef : fail($self, $?)) : 1; } sub lei_daemon_pid { puts shift, $$ } -- cgit v1.2.3-24-ge0c7