From ed1ad9b3b6ea3e6e22deaaf54fdc8230a3b09b8c Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 7 Oct 2023 21:24:09 +0000 Subject: process_io: pass args to awaitpid as list Specifying {cb_args} in the options hash felt awkward to me. Instead, just use the Perl stack like we do with awaitpid() and pass the list down directly. --- lib/PublicInbox/Spawn.pm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'lib/PublicInbox/Spawn.pm') diff --git a/lib/PublicInbox/Spawn.pm b/lib/PublicInbox/Spawn.pm index cb8b21c6..ec256698 100644 --- a/lib/PublicInbox/Spawn.pm +++ b/lib/PublicInbox/Spawn.pm @@ -366,15 +366,17 @@ sub spawn ($;$$) { } sub popen_rd { - my ($cmd, $env, $opt) = @_; + my ($cmd, $env, $opt, @cb_arg) = @_; pipe(my $r, local $opt->{1}) or die "pipe: $!\n"; - PublicInbox::ProcessIO->maybe_new(spawn($cmd, $env, $opt), $r, $opt) + my $pid = spawn($cmd, $env, $opt); + PublicInbox::ProcessIO->maybe_new($pid, $r, @cb_arg); } sub popen_wr { - my ($cmd, $env, $opt) = @_; + my ($cmd, $env, $opt, @cb_arg) = @_; pipe(local $opt->{0}, my $w) or die "pipe: $!\n"; - PublicInbox::ProcessIO->maybe_new(spawn($cmd, $env, $opt), $w, $opt) + my $pid = spawn($cmd, $env, $opt); + PublicInbox::ProcessIO->maybe_new($pid, $w, @cb_arg) } sub run_wait ($;$$) { -- cgit v1.2.3-24-ge0c7