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 {
219219 my $exit_code = $? >> 8;
220220 return unless $signalled or $exit_code ;
221221
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+ }
222232 return sprintf (__(" fatal: command '%s ' died with exit code %d " ),
223- $args -> [0], $exit_code );
233+ @sprintf_args );
224234}
225235
226236sub 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' '
644644 test_cmp expect actual
645645'
646646
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 <nobody@example.com>" \
661+ --to=nobody@example.com \
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+
647668test_expect_success $PREREQ ' setup fake editor' '
648669 write_script fake-editor <<-\EOF
649670 echo fake edit >>"$1"
650671 EOF
651672'
652673
653- test_set_editor " $( pwd) /fake-editor"
654-
655674test_expect_success $PREREQ ' --compose works' '
656675 clean_fake_sendmail &&
657676 git send-email \
You can’t perform that action at this time.
0 commit comments