about summary refs log tree commit homepage
diff options
context:
space:
mode:
-rw-r--r--lib/PublicInbox/ProcessPipe.pm2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/PublicInbox/ProcessPipe.pm b/lib/PublicInbox/ProcessPipe.pm
index 16971801..ba2c1ecb 100644
--- a/lib/PublicInbox/ProcessPipe.pm
+++ b/lib/PublicInbox/ProcessPipe.pm
@@ -58,7 +58,7 @@ sub FILENO { fileno($_[0]->{fh}) }
 sub _close ($;$) {
         my ($self, $wait) = @_;
         my ($fh, $pid) = delete(@$self{qw(fh pid)});
-        my $ret = defined($fh) ? close($fh) : '';
+        my $ret = (defined($fh) && $wait) ? close($fh) : ($fh = '');
         return $ret unless defined($pid) && $self->{ppid} == $$;
         if ($wait) { # caller cares about the exit status:
                 # synchronous wait via defined(wantarray) on awaitpid: