]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'ta/wait-on-aliased-commands-upon-signal' into master
authorJunio C Hamano <gitster@pobox.com>
Wed, 15 Jul 2020 23:29:43 +0000 (16:29 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 15 Jul 2020 23:29:43 +0000 (16:29 -0700)
When an aliased command, whose output is piped to a pager by git,
gets killed by a signal, the pager got into a funny state, which
has been corrected (again).

* ta/wait-on-aliased-commands-upon-signal:
  Wait for child on signal death for aliases to externals
  Wait for child on signal death for aliases to builtins

git.c
run-command.c
run-command.h

diff --git a/git.c b/git.c
index 2f021b97f344c668ba1753c66f015567f122a378..6cd887bb0cffce589a14afc0205aefa3764c9eff 100644 (file)
--- a/git.c
+++ b/git.c
@@ -346,6 +346,8 @@ static int handle_alias(int *argcp, const char ***argv)
                        commit_pager_choice();
 
                        child.use_shell = 1;
+                       child.clean_on_exit = 1;
+                       child.wait_after_clean = 1;
                        child.trace2_child_class = "shell_alias";
                        argv_array_push(&child.args, alias_string + 1);
                        argv_array_pushv(&child.args, (*argv) + 1);
@@ -767,7 +769,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 9b3a57d1e392c8d311cfbfbad7859e9e627cd5ef..a735e380a9c2bb8e461e1182ab3103cbd5cc960b 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 191dfcdafe3dfcf6aff4b1c15e1be0924fbdb2d1..ef3071a56560a53aac8072dcd001113e28c65877 100644 (file)
@@ -229,6 +229,7 @@ int run_auto_gc(int quiet);
 #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