From 3cea12e29643a02bc9d33802896d3dd12c8bc8fa Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 27 Sep 2023 06:02:47 +0000 Subject: convert: use ProcessPipe with popen_rd ProcessPipe->CLOSE will already run waitpid for us and exit on errors, so we can do less, here. --- script/public-inbox-convert | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'script') diff --git a/script/public-inbox-convert b/script/public-inbox-convert index 96931cbf..780f7194 100755 --- a/script/public-inbox-convert +++ b/script/public-inbox-convert @@ -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) { -- cgit v1.2.3-24-ge0c7