]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
convert: use ProcessPipe with popen_rd
authorEric Wong <e@80x24.org>
Wed, 27 Sep 2023 06:02:47 +0000 (06:02 +0000)
committerEric Wong <e@80x24.org>
Thu, 28 Sep 2023 02:34:56 +0000 (02:34 +0000)
ProcessPipe->CLOSE will already run waitpid for us and
exit on errors, so we can do less, here.

script/public-inbox-convert

index 96931cbf39312edf0c8a7d6ec1e4460e521b24b2..780f7194150b15a840504c2dd940bf795ce93bd8 100755 (executable)
@@ -117,7 +117,7 @@ $clone may not be valid after migrating to v2, not copying
 }
 my $state = '';
 my $head = $old->{ref_head} || 'HEAD';
-my ($rd, $pid) = $old->git->popen(qw(fast-export --use-done-feature), $head);
+my $rd = $old->git->popen(qw(fast-export --use-done-feature), $head);
 $v2w->idx_init($opt);
 my $im = $v2w->importer;
 my ($r, $w) = $im->gfi_start;
@@ -164,9 +164,7 @@ while (<$rd>) {
        last if $_ eq "done\n";
        print $w $_ or $im->wfail;
 }
-close $rd or die "close fast-export: $!\n";
-waitpid($pid, 0) or die "waitpid failed: $!\n";
-$? == 0 or die "fast-export failed: $?\n";
+close $rd or die "fast-export: \$?=$? \$!=$!\n";
 $r = $w = undef; # v2w->done does the actual close and error checking
 $v2w->done;
 if (my $old_mm = $old->mm) {