pager: properly log pager exit code when signalled
commitbe8fc53e364211856cca7affa4472855f96f8fa9
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Tue, 2 Feb 2021 02:00:00 +0000 (2 03:00 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 2 Feb 2021 05:15:58 +0000 (1 21:15 -0800)
tree4229319ea2b3c7819e719dbb2a8fed3b27d632c8
parent85db79a96ede0a2c296b2e41df472025f32806cc
pager: properly log pager exit code when signalled

When git invokes a pager that exits with non-zero the common case is
that we'll already return the correct SIGPIPE failure from git itself,
but the exit code logged in trace2 has always been incorrectly
reported[1]. Fix that and log the correct exit code in the logs.

Since this gives us something to test outside of our recently-added
tests needing a !MINGW prerequisite, let's refactor the test to run on
MINGW and actually check for SIGPIPE outside of MINGW.

The wait_or_whine() is only called with a true "in_signal" from from
finish_command_in_signal(), which in turn is only used in pager.c.

The "in_signal && !WIFEXITED(status)" case is not covered by
tests. Let's log the default -1 in that case for good measure.

1. The incorrect logging of the exit code in was seemingly copy/pasted
   into finish_command_in_signal() in ee4512ed481 (trace2: create new
   combined trace facility, 2019-02-22)

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
run-command.c
t/t7006-pager.sh