summaryrefslogtreecommitdiff
path: root/pager.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2021-02-22 16:12:43 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-02-22 16:12:43 -0800
commitdcb11fc6225edbe2bd7af63eb550b739e7f4a074 (patch)
treede4f1af9240b7746606d89c0ded10b5a2941fd05 /pager.c
parentMerge branch 'ta/hash-function-transition-doc' (diff)
parentpager: properly log pager exit code when signalled (diff)
downloadtgif-dcb11fc6225edbe2bd7af63eb550b739e7f4a074.tar.xz
Merge branch 'ab/pager-exit-log'
When a pager spawned by us exited, the trace log did not record its exit status correctly, which has been corrected. * ab/pager-exit-log: pager: properly log pager exit code when signalled run-command: add braces for "if" block in wait_or_whine() pager: test for exit code with and without SIGPIPE pager: refactor wait_for_pager() function
Diffstat (limited to 'pager.c')
-rw-r--r--pager.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/pager.c b/pager.c
index ee435de675..3d37dd7ada 100644
--- a/pager.c
+++ b/pager.c
@@ -11,29 +11,25 @@
static struct child_process pager_process = CHILD_PROCESS_INIT;
static const char *pager_program;
-static void wait_for_pager(int in_signal)
+static void close_pager_fds(void)
{
- if (!in_signal) {
- fflush(stdout);
- fflush(stderr);
- }
/* signal EOF to pager */
close(1);
close(2);
- if (in_signal)
- finish_command_in_signal(&pager_process);
- else
- finish_command(&pager_process);
}
static void wait_for_pager_atexit(void)
{
- wait_for_pager(0);
+ fflush(stdout);
+ fflush(stderr);
+ close_pager_fds();
+ finish_command(&pager_process);
}
static void wait_for_pager_signal(int signo)
{
- wait_for_pager(1);
+ close_pager_fds();
+ finish_command_in_signal(&pager_process);
sigchain_pop(signo);
raise(signo);
}