Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixup! pager: fix order of atexit() calls #119

Merged
merged 1 commit into from
Feb 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 0 additions & 6 deletions git.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
9 changes: 3 additions & 6 deletions pager.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down