Thread (16 messages) flat view 16 messages, 2 authors, 2021-08-17

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

From: Jeff King <hidden>
Date: 2021-08-16 22:30:01
Subsystem: the rest · Maintainer: Linus Torvalds

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help