git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [ANNOUNCE] Git v2.33.0-rc2 (Build/Test Report)

From
Jeff King <peff@peff.net>
Date
Aug 16, 2021, 22:29 UTC
Message-ID
<YRrm5odz3WhcUQS9@coredump.intra.peff.net>
In-Reply-To
<YRrlQwLENaWs8zWm@coredump.intra.peff.net>
On Mon, Aug 16, 2021 at 06:22:59PM -0400, Jeff King wrote:
> Yeah, I think we are better to get a consistent exit code from perl.
> There are a few options here:

So concretely, the patch below works for me (my tests are not failing, but with some instrumenting, I see that the case in question is exiting with code 25 before this patch, and 255 after. So it really is just that my errno values are lower than yours).

It's ugly, and I kind of wonder if we'd want to do it for every script to get consistent exit codes. But it does work.

diff --git a/git-send-email.perl b/git-send-email.perl
index e65d969d0b..c82336c2e8 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -35,8 +35,15 @@ sub readline {
 	my $self = shift;
 	die "Cannot use readline on FakeTerm: $$self";
 }
+
 package main;
 
+$SIG{__DIE__} = sub {
+	CORE::die @_ if $^S; # in an eval; use regular die
+	CORE::die @_ if !defined $^S; # in perl's parser
+	print STDERR "fatal: @_\n";
+	exit 255;
+};
 
 sub usage {
 	print <<EOT;

-Peff
Previous: Jeff KingNext: Randall S. Becker
Message 15 of 17 in “RE: [ANNOUNCE] Git v2.33.0-rc2 (Build/Test Report)”
  1. Randall S. BeckerAug 13, 2021
  2. Junio C HamanoAug 13, 2021
  3. Jeff KingAug 13, 2021
  4. Randall S. BeckerAug 16, 2021
  5. Jeff KingAug 16, 2021
  6. Randall S. BeckerAug 16, 2021
  7. Jeff KingAug 16, 2021
  8. Jeff KingAug 16, 2021
  9. Randall S. BeckerAug 16, 2021
  10. Jeff KingAug 16, 2021
  11. Randall S. BeckerAug 16, 2021
  12. Jeff KingAug 16, 2021
  13. Randall S. BeckerAug 16, 2021
  14. Jeff KingAug 16, 2021
  15. Jeff KingAug 16, 2021
  16. Randall S. BeckerAug 17, 2021
  17. Randall S. BeckerAug 17, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.