Skip to content

Commit e662df7

Browse files
trygveaagitster
authored andcommitted
Wait for child on signal death for aliases to builtins
When you hit ^C all the processes in the tree receives it. When a git command uses a pager, git ignores this and waits until the pager quits. However, when using an alias there is an additional process in the tree which didn't ignore the signal. That caused it to exit which in turn caused the pager to exit. This fixes that for aliases to builtins. This was originally fixed in 46df690 (execv_dashed_external: wait for child on signal death, 2017-01-06), but was broken by ee4512e (trace2: create new combined trace facility, 2019-02-22) and then b914084 (git: avoid calling aliased builtins via their dashed form, 2019-07-29). Signed-off-by: Trygve Aaberge <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent af6b65d commit e662df7

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

git.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,7 @@ static int run_argv(int *argcp, const char ***argv)
768768
* OK to return. Otherwise, we just pass along the status code.
769769
*/
770770
i = run_command_v_opt_tr2(args.argv, RUN_SILENT_EXEC_FAILURE |
771-
RUN_CLEAN_ON_EXIT, "git_alias");
771+
RUN_CLEAN_ON_EXIT | RUN_WAIT_AFTER_CLEAN, "git_alias");
772772
if (i >= 0 || errno != ENOENT)
773773
exit(i);
774774
die("could not execute builtin %s", **argv);

run-command.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,6 +1039,7 @@ int run_command_v_opt_cd_env_tr2(const char **argv, int opt, const char *dir,
10391039
cmd.silent_exec_failure = opt & RUN_SILENT_EXEC_FAILURE ? 1 : 0;
10401040
cmd.use_shell = opt & RUN_USING_SHELL ? 1 : 0;
10411041
cmd.clean_on_exit = opt & RUN_CLEAN_ON_EXIT ? 1 : 0;
1042+
cmd.wait_after_clean = opt & RUN_WAIT_AFTER_CLEAN ? 1 : 0;
10421043
cmd.dir = dir;
10431044
cmd.env = env;
10441045
cmd.trace2_child_class = tr2_class;

run-command.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ int run_hook_ve(const char *const *env, const char *name, va_list args);
224224
#define RUN_SILENT_EXEC_FAILURE 8
225225
#define RUN_USING_SHELL 16
226226
#define RUN_CLEAN_ON_EXIT 32
227+
#define RUN_WAIT_AFTER_CLEAN 64
227228

228229
/**
229230
* Convenience functions that encapsulate a sequence of

0 commit comments

Comments
 (0)