From 79dca30445999178fe5666737fcd6710342c1a84 Mon Sep 17 00:00:00 2001 From: Ben Peart Date: Wed, 13 Feb 2019 16:45:47 -0500 Subject: [PATCH] fixup! pager: fix order of atexit() calls This reverts commit 3f588065b0 as it no longer fixes the underlying issue. Signed-off-by: Ben Peart --- cache.h | 1 - git.c | 6 ------ pager.c | 9 +++------ 3 files changed, 3 insertions(+), 13 deletions(-) diff --git a/cache.h b/cache.h index cf849fe505cd59..0686f4956c34f7 100644 --- a/cache.h +++ b/cache.h @@ -1669,7 +1669,6 @@ extern void write_file(const char *path, const char *fmt, ...); /* pager.c */ extern void setup_pager(void); -extern void wait_for_pager_atexit(void); extern int pager_in_use(void); extern int pager_use_color; extern int term_columns(void); diff --git a/git.c b/git.c index 3eca6352bb1a6b..2767cf77b663ff 100644 --- a/git.c +++ b/git.c @@ -893,12 +893,6 @@ int cmd_main(int argc, const char **argv) cmd = slash + 1; } - /* - * wait_for_pager_atexit will close stdout/stderr so it needs to be - * registered first so that it will execute last and not close the - * handles until all other atexit handlers have finished - */ - atexit(wait_for_pager_atexit); trace_command_performance(argv); atexit(post_command_hook_atexit); diff --git a/pager.c b/pager.c index 1c82a868ee0a7d..4168460ae92ceb 100644 --- a/pager.c +++ b/pager.c @@ -26,12 +26,9 @@ static void wait_for_pager(int in_signal) finish_command(&pager_process); } - -static int run_wait_for_pager_atexit = 0; -void wait_for_pager_atexit(void) +static void wait_for_pager_atexit(void) { - if (run_wait_for_pager_atexit) - wait_for_pager(0); + wait_for_pager(0); } static void wait_for_pager_signal(int signo) @@ -141,7 +138,7 @@ void setup_pager(void) /* this makes sure that the parent terminates after the pager */ sigchain_push_common(wait_for_pager_signal); - run_wait_for_pager_atexit = 1; + atexit(wait_for_pager_atexit); } int pager_in_use(void)