]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Spawn.pm
reduce calls to close unless error checks are needed
[public-inbox.git] / lib / PublicInbox / Spawn.pm
index 72cd6c3cc4fce032bb8ce36b025854dbeb5b67b4..02c5446f6dcf0f965471498656a60fb9a720ad07 100644 (file)
@@ -165,18 +165,12 @@ sub spawn ($;$$) {
 
 sub popen_rd {
        my ($cmd, $env, $opts) = @_;
-       unless (wantarray || defined $vfork_spawn || defined $env) {
-               open my $fh, '-|', @$cmd or
-                       die('open `'.join(' ', @$cmd) . " pipe failed: $!\n");
-               return $fh
-       }
        pipe(my ($r, $w)) or die "pipe: $!\n";
        $opts ||= {};
        my $blocking = $opts->{Blocking};
        $r->blocking($blocking) if defined $blocking;
        $opts->{1} = fileno($w);
        my $pid = spawn($cmd, $env, $opts);
-       close $w;
        return ($r, $pid) if wantarray;
        my $ret = gensym;
        tie *$ret, 'PublicInbox::ProcessPipe', $pid, $r;