diff options
author | Eric Wong <e@80x24.org> | 2023-10-07 21:24:09 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2023-10-08 18:54:48 +0000 |
commit | ed1ad9b3b6ea3e6e22deaaf54fdc8230a3b09b8c (patch) | |
tree | dce43f04eaf5818ab783bcc859001c4e34fd618e /lib/PublicInbox/Spawn.pm | |
parent | 1661ff8e21f3cb1df1a3fc00d917f404f4eae734 (diff) | |
download | public-inbox-ed1ad9b3b6ea3e6e22deaaf54fdc8230a3b09b8c.tar.gz |
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.
Diffstat (limited to 'lib/PublicInbox/Spawn.pm')
-rw-r--r-- | lib/PublicInbox/Spawn.pm | 10 |
1 files changed, 6 insertions, 4 deletions
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 ($;$$) { |