]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Spawn.pm
processpipe: allow synchronous close to set $?
[public-inbox.git] / lib / PublicInbox / Spawn.pm
index 1ee40503c33f0b014bb6814295d890e3335133e2..762a0549bba4e95b5d62693767ab499117ecde93 100644 (file)
@@ -295,14 +295,14 @@ sub spawn ($;$$) {
 }
 
 sub popen_rd {
-       my ($cmd, $env, $opts) = @_;
+       my ($cmd, $env, $opt) = @_;
        pipe(my ($r, $w)) or die "pipe: $!\n";
-       $opts ||= {};
-       $opts->{1} = fileno($w);
-       my $pid = spawn($cmd, $env, $opts);
+       $opt ||= {};
+       $opt->{1} = fileno($w);
+       my $pid = spawn($cmd, $env, $opt);
        return ($r, $pid) if wantarray;
        my $ret = gensym;
-       tie *$ret, 'PublicInbox::ProcessPipe', $pid, $r;
+       tie *$ret, 'PublicInbox::ProcessPipe', $pid, $r, @$opt{qw(cb arg)};
        $ret;
 }