unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
* [PATCH] git: check for --version errors
@ 2023-03-26 23:48 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2023-03-26 23:48 UTC (permalink / raw)
  To: meta

While unlikely, `git --version' may fail, so we must check for
errors and by reaping the process ASAP via tied close().
---
 lib/PublicInbox/Git.pm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/PublicInbox/Git.pm b/lib/PublicInbox/Git.pm
index 2729b38f..6f8232cf 100644
--- a/lib/PublicInbox/Git.pm
+++ b/lib/PublicInbox/Git.pm
@@ -64,6 +64,7 @@ sub check_git_exe () {
 	if ($st ne $EXE_ST) {
 		my $rd = popen_rd([ $GIT_EXE, '--version' ]);
 		my $v = readline($rd);
+		close($rd) or die "$GIT_EXE --version: $?";
 		$v =~ /\b([0-9]+(?:\.[0-9]+){2})/ or die
 			"$GIT_EXE --version output: $v # unparseable";
 		my @v = split(/\./, $1, 3);

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-03-26 23:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-26 23:48 [PATCH] git: check for --version errors Eric Wong

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