about summary refs log tree commit homepage
diff options
context:
space:
mode:
-rw-r--r--lib/PublicInbox/Spawn.pm6
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/PublicInbox/Spawn.pm b/lib/PublicInbox/Spawn.pm
index 8c798b39..8cc4dfaf 100644
--- a/lib/PublicInbox/Spawn.pm
+++ b/lib/PublicInbox/Spawn.pm
@@ -384,16 +384,14 @@ sub spawn ($;$$) {
 sub popen_rd {
         my ($cmd, $env, $opt, @cb_arg) = @_;
         pipe(my $r, local $opt->{1});
-        my $pid = spawn($cmd, $env, $opt);
-        wantarray ? ($r, $pid) : PublicInbox::IO::attach_pid($r, $pid, @cb_arg)
+        PublicInbox::IO::attach_pid($r, spawn($cmd, $env, $opt), @cb_arg);
 }
 
 sub popen_wr {
         my ($cmd, $env, $opt, @cb_arg) = @_;
         pipe(local $opt->{0}, my $w);
         $w->autoflush(1);
-        my $pid = spawn($cmd, $env, $opt);
-        wantarray ? ($w, $pid) : PublicInbox::IO::attach_pid($w, $pid, @cb_arg)
+        PublicInbox::IO::attach_pid($w, spawn($cmd, $env, $opt), @cb_arg);
 }
 
 sub read_out_err ($) {