From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 69C721F560 for ; Wed, 27 Sep 2023 06:02:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1695794569; bh=Zn3EYJ7MKL8d8C8es6tq0OXhxrQAOdlxD5Y9Sj+7Oac=; h=From:To:Subject:Date:In-Reply-To:References:From; b=DBo/S7+LfRmXN5hW+9mf9Pi7spkT6T/KCrMUbWD0bXRa/3o7EmiUu7gTgt5Sim3HT bZHDbXFuGlyjT7gNtbYCSXoNv/7gzWF9bHkSBUsiDuzn66PoHx0VhqWdST5wK7cSfM pe09ur7rcI5E4wWICEnFr948+FOlryv6EU90eVaY= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 1/3] convert: use ProcessPipe with popen_rd Date: Wed, 27 Sep 2023 06:02:47 +0000 Message-ID: <20230927060249.706224-2-e@80x24.org> In-Reply-To: <20230927060249.706224-1-e@80x24.org> References: <20230927060249.706224-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: 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(-) 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) {