From: Eric Wong <e@yhbt.net>
Date: Wed, 20 May 2020 07:38:08 +0000 (+0000)
Subject: convert: describe the release of fast-import pipes
X-Git-Tag: v1.6.0~495
X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=7eda704e4ec5b2ab897ef8da4fc90c48fcfc45a9;p=public-inbox.git

convert: describe the release of fast-import pipes

Upon rereading the code, it wasn't immediately obvious to
me why we didn't check for errors with `close($w)' instead
of relying on `undef'.  So add a comment for the benefit of
future readers.
---

diff --git a/script/public-inbox-convert b/script/public-inbox-convert
index 7fb15adf..dbb2bd38 100755
--- a/script/public-inbox-convert
+++ b/script/public-inbox-convert
@@ -144,10 +144,10 @@ while (<$rd>) {
 	last if $_ eq "done\n";
 	print $w $_ or $im->wfail;
 }
-$w = $r = undef;
 close $rd or die "close fast-export: $!\n";
 waitpid($pid, 0) or die "waitpid failed: $!\n";
 $? == 0 or die "fast-export failed: $?\n";
+$r = $w = undef; # v2w->done does the actual close and error checking
 $v2w->done;
 if (my $mm = $old->mm) {
 	$old->cleanup;