Skip to content

Commit 8af1f39

Browse files
authored
Merge pull request #119 from benpeart/revert-pager-atexit
fixup! pager: fix order of atexit() calls
2 parents 178619c + 79dca30 commit 8af1f39

3 files changed

Lines changed: 3 additions & 13 deletions

File tree

cache.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1669,7 +1669,6 @@ extern void write_file(const char *path, const char *fmt, ...);
16691669

16701670
/* pager.c */
16711671
extern void setup_pager(void);
1672-
extern void wait_for_pager_atexit(void);
16731672
extern int pager_in_use(void);
16741673
extern int pager_use_color;
16751674
extern int term_columns(void);

git.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -893,12 +893,6 @@ int cmd_main(int argc, const char **argv)
893893
cmd = slash + 1;
894894
}
895895

896-
/*
897-
* wait_for_pager_atexit will close stdout/stderr so it needs to be
898-
* registered first so that it will execute last and not close the
899-
* handles until all other atexit handlers have finished
900-
*/
901-
atexit(wait_for_pager_atexit);
902896
trace_command_performance(argv);
903897
atexit(post_command_hook_atexit);
904898

pager.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,9 @@ static void wait_for_pager(int in_signal)
2626
finish_command(&pager_process);
2727
}
2828

29-
30-
static int run_wait_for_pager_atexit = 0;
31-
void wait_for_pager_atexit(void)
29+
static void wait_for_pager_atexit(void)
3230
{
33-
if (run_wait_for_pager_atexit)
34-
wait_for_pager(0);
31+
wait_for_pager(0);
3532
}
3633

3734
static void wait_for_pager_signal(int signo)
@@ -141,7 +138,7 @@ void setup_pager(void)
141138

142139
/* this makes sure that the parent terminates after the pager */
143140
sigchain_push_common(wait_for_pager_signal);
144-
run_wait_for_pager_atexit = 1;
141+
atexit(wait_for_pager_atexit);
145142
}
146143

147144
int pager_in_use(void)

0 commit comments

Comments
 (0)