Skip to content

Commit 05920f0

Browse files
committed
Merge branch 'ta/wait-on-aliased-commands-upon-signal' into master
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
2 parents bd42bbe + c0d73a5 commit 05920f0

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

git.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,8 @@ static int handle_alias(int *argcp, const char ***argv)
346346
commit_pager_choice();
347347

348348
child.use_shell = 1;
349+
child.clean_on_exit = 1;
350+
child.wait_after_clean = 1;
349351
child.trace2_child_class = "shell_alias";
350352
argv_array_push(&child.args, alias_string + 1);
351353
argv_array_pushv(&child.args, (*argv) + 1);
@@ -767,7 +769,7 @@ static int run_argv(int *argcp, const char ***argv)
767769
* OK to return. Otherwise, we just pass along the status code.
768770
*/
769771
i = run_command_v_opt_tr2(args.argv, RUN_SILENT_EXEC_FAILURE |
770-
RUN_CLEAN_ON_EXIT, "git_alias");
772+
RUN_CLEAN_ON_EXIT | RUN_WAIT_AFTER_CLEAN, "git_alias");
771773
if (i >= 0 || errno != ENOENT)
772774
exit(i);
773775
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
@@ -229,6 +229,7 @@ int run_auto_gc(int quiet);
229229
#define RUN_SILENT_EXEC_FAILURE 8
230230
#define RUN_USING_SHELL 16
231231
#define RUN_CLEAN_ON_EXIT 32
232+
#define RUN_WAIT_AFTER_CLEAN 64
232233

233234
/**
234235
* Convenience functions that encapsulate a sequence of

0 commit comments

Comments
 (0)