@matheusbsbs / matheus-bagliano / commits / e662df7e83
Fork 0

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 46df6906 (execv_dashed_external: wait for child on signal death, 2017-01-06), but was broken by ee4512ed (trace2: create new combined trace facility, 2019-02-22) and then b9140840 (git: avoid calling aliased builtins via their dashed form, 2019-07-29). Signed-off-by: Trygve Aaberge <trygveaa@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Trygve Aaberge committed Jul 7, 2020 at 14:17 UTC e662df7e830a9d93ca36b74a7b5e670e139b0da1
3 files changed +3 -1
git.c
+1 -1
@@ -768,7 +768,7 @@ static int run_argv(int *argcp, const char ***argv)
768 * OK to return. Otherwise, we just pass along the status code.
769 */
770 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");
772 if (i >= 0 || errno != ENOENT)
773 exit(i);
774 die("could not execute builtin %s", **argv);
run-command.c
+1
@@ -1039,6 +1039,7 @@ int run_command_v_opt_cd_env_tr2(const char **argv, int opt, const char *dir,
1039 cmd.silent_exec_failure = opt & RUN_SILENT_EXEC_FAILURE ? 1 : 0;
1040 cmd.use_shell = opt & RUN_USING_SHELL ? 1 : 0;
1041 cmd.clean_on_exit = opt & RUN_CLEAN_ON_EXIT ? 1 : 0;
1042 + cmd.wait_after_clean = opt & RUN_WAIT_AFTER_CLEAN ? 1 : 0;
1043 cmd.dir = dir;
1044 cmd.env = env;
1045 cmd.trace2_child_class = tr2_class;
run-command.h
+1
@@ -224,6 +224,7 @@ int run_hook_ve(const char *const *env, const char *name, va_list args);
224 #define RUN_SILENT_EXEC_FAILURE 8
225 #define RUN_USING_SHELL 16
226 #define RUN_CLEAN_ON_EXIT 32
227 +#define RUN_WAIT_AFTER_CLEAN 64
228
229 /**
230 * Convenience functions that encapsulate a sequence of