File tree Expand file tree Collapse file tree 2 files changed +32
-3
lines changed Expand file tree Collapse file tree 2 files changed +32
-3
lines changed Original file line number Diff line number Diff line change @@ -219,8 +219,18 @@ sub system_or_msg {
219
219
my $exit_code = $? >> 8;
220
220
return unless $signalled or $exit_code ;
221
221
222
+ my @sprintf_args = ($args -> [0], $exit_code );
223
+ if (defined $msg ) {
224
+ # Quiet the 'redundant' warning category, except we
225
+ # need to support down to Perl 5.8, so we can't do a
226
+ # "no warnings 'redundant'", since that category was
227
+ # introduced in perl 5.22, and asking for it will die
228
+ # on older perls.
229
+ no warnings;
230
+ return sprintf ($msg , @sprintf_args );
231
+ }
222
232
return sprintf (__(" fatal: command '%s ' died with exit code %d " ),
223
- $args -> [0], $exit_code );
233
+ @sprintf_args );
224
234
}
225
235
226
236
sub system_or_die {
Original file line number Diff line number Diff line change @@ -644,14 +644,33 @@ test_expect_success $PREREQ 'In-Reply-To with --chain-reply-to' '
644
644
test_cmp expect actual
645
645
'
646
646
647
+ test_set_editor " $( pwd) /fake-editor"
648
+
649
+ test_expect_success $PREREQ ' setup erroring fake editor' '
650
+ write_script fake-editor <<-\EOF
651
+ echo >&2 "I am about to error"
652
+ exit 1
653
+ EOF
654
+ '
655
+
656
+ test_expect_success $PREREQ ' fake editor dies with error' '
657
+ clean_fake_sendmail &&
658
+ test_must_fail git send-email \
659
+ --compose --subject foo \
660
+ --from="Example <[email protected] >" \
661
+
662
+ --smtp-server="$(pwd)/fake.sendmail" \
663
+ $patches 2>err &&
664
+ grep "I am about to error" err &&
665
+ grep "the editor exited uncleanly, aborting everything" err
666
+ '
667
+
647
668
test_expect_success $PREREQ ' setup fake editor' '
648
669
write_script fake-editor <<-\EOF
649
670
echo fake edit >>"$1"
650
671
EOF
651
672
'
652
673
653
- test_set_editor " $( pwd) /fake-editor"
654
-
655
674
test_expect_success $PREREQ ' --compose works' '
656
675
clean_fake_sendmail &&
657
676
git send-email \
You can’t perform that action at this time.
0 commit comments