]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Wait for child on signal death for aliases to builtins
authorTrygve Aaberge <trygveaa@gmail.com>
Tue, 7 Jul 2020 12:17:14 +0000 (14:17 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 7 Jul 2020 20:14:05 +0000 (13:14 -0700)
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>
git.c
run-command.c
run-command.h

diff --git a/git.c b/git.c
index 7be7ad34bd053884ec48923706e70c81719a8660..9b8d3c92e6e8d22493bb6febb4487704e47c6c12 100644 (file)
--- a/git.c
+++ b/git.c
@@ -768,7 +768,7 @@ static int run_argv(int *argcp, const char ***argv)
                         * OK to return. Otherwise, we just pass along the status code.
                         */
                        i = run_command_v_opt_tr2(args.argv, RUN_SILENT_EXEC_FAILURE |
-                                                 RUN_CLEAN_ON_EXIT, "git_alias");
+                                                 RUN_CLEAN_ON_EXIT | RUN_WAIT_AFTER_CLEAN, "git_alias");
                        if (i >= 0 || errno != ENOENT)
                                exit(i);
                        die("could not execute builtin %s", **argv);
index f5e1149f9b395e77c3d55a147332c1117746d7b1..5d65335d135ced2f58b91ffca605858cd4a09574 100644 (file)
@@ -1039,6 +1039,7 @@ int run_command_v_opt_cd_env_tr2(const char **argv, int opt, const char *dir,
        cmd.silent_exec_failure = opt & RUN_SILENT_EXEC_FAILURE ? 1 : 0;
        cmd.use_shell = opt & RUN_USING_SHELL ? 1 : 0;
        cmd.clean_on_exit = opt & RUN_CLEAN_ON_EXIT ? 1 : 0;
+       cmd.wait_after_clean = opt & RUN_WAIT_AFTER_CLEAN ? 1 : 0;
        cmd.dir = dir;
        cmd.env = env;
        cmd.trace2_child_class = tr2_class;
index 0f3cc73ab6727e9b3805d93e5e4ab4dec3c1d5cb..1641ccf94bab972303453507f38c5b657a155ce1 100644 (file)
@@ -224,6 +224,7 @@ int run_hook_ve(const char *const *env, const char *name, va_list args);
 #define RUN_SILENT_EXEC_FAILURE 8
 #define RUN_USING_SHELL 16
 #define RUN_CLEAN_ON_EXIT 32
+#define RUN_WAIT_AFTER_CLEAN 64
 
 /**
  * Convenience functions that encapsulate a sequence of