git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
* [PATCH 1/2] Wait for child on signal death for aliases to builtins
@ 2020-07-04 22:18 trygveaa
  2020-07-04 22:18 ` [PATCH 2/2] Wait for child on signal death for aliases to externals trygveaa
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: trygveaa @ 2020-07-04 22:18 UTC (permalink / raw)
  To: git
  Cc: Johannes Schindelin, Trygve Aaberge, Jeff Hostetler, Heba Waly,
	Junio C Hamano

From: Trygve Aaberge <trygveaa@gmail.com>

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 46df6906f3 (see that for a more in
explanation), but broke by a regression in b914084007.

Signed-off-by: Trygve Aaberge <trygveaa@gmail.com>
---
 git.c         | 2 +-
 run-command.c | 1 +
 run-command.h | 1 +
 3 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/git.c b/git.c
index a2d337eed7..c8336773e3 100644
--- a/git.c
+++ b/git.c
@@ -767,7 +767,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);
diff --git a/run-command.c b/run-command.c
index 9b3a57d1e3..a735e380a9 100644
--- a/run-command.c
+++ b/run-command.c
@@ -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;
diff --git a/run-command.h b/run-command.h
index 191dfcdafe..ef3071a565 100644
--- a/run-command.h
+++ b/run-command.h
@@ -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
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2020-07-07 22:06 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-04 22:18 [PATCH 1/2] Wait for child on signal death for aliases to builtins trygveaa
2020-07-04 22:18 ` [PATCH 2/2] Wait for child on signal death for aliases to externals trygveaa
2020-07-06 21:14   ` Jeff King
2020-07-07  1:38     ` Junio C Hamano
2020-07-07 10:19     ` Trygve Aaberge
2020-07-07 22:06       ` Jeff King
2020-07-05  2:15 ` [PATCH 1/2] Wait for child on signal death for aliases to builtins Johannes Schindelin
2020-07-07  1:48   ` Junio C Hamano
2020-07-06 20:41 ` Jeff King
2020-07-07  1:50   ` Junio C Hamano
2020-07-07 10:23     ` Trygve Aaberge
2020-07-07 12:17 ` [PATCH v2 " trygveaa
2020-07-07 12:17   ` [PATCH v2 2/2] Wait for child on signal death for aliases to externals trygveaa

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).