unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 1/3] convert: use ProcessPipe with popen_rd
Date: Wed, 27 Sep 2023 06:02:47 +0000	[thread overview]
Message-ID: <20230927060249.706224-2-e@80x24.org> (raw)
In-Reply-To: <20230927060249.706224-1-e@80x24.org>

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) {

  reply	other threads:[~2023-09-27  6:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-27  6:02 [PATCH 0/3] more process management cleanups + bugfix Eric Wong
2023-09-27  6:02 ` Eric Wong [this message]
2023-09-27  6:02 ` [PATCH 2/3] spawn: add popen_wr support Eric Wong
2023-09-27  6:02 ` [PATCH 3/3] lei: don't gzip --rsyncable by default for mbox* Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230927060249.706224-2-e@80x24.org \
    --to=e@80x24.org \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).