git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2 2/2] Wait for child on signal death for aliases to externals

From
trygveaa@gmail.com <trygveaa@gmail.com>
Date
Jul 7, 2020, 12:17 UTC
Message-ID
<20200707121716.438318-2-trygveaa@gmail.com>
In-Reply-To
<20200707121716.438318-1-trygveaa@gmail.com>
From: Trygve Aaberge <trygveaa@gmail.com>

When we are running an alias to an external command, we want to wait for that process to exit even after receiving ^C which normally kills the git process. This is useful when the process is ignoring SIGINT (which e.g. pagers often do), and then we don't want it to be killed.

Having an alias which invokes a pager is probably not common, but it can be useful e.g. if you have an alias to a git command which uses a subshell as one of the arguments (in which case you have to use an external command, not an alias to a builtin).

This patch is similar to the previous commit, but the previous commit fixed this only for aliases to builtins, while this commit does the same for aliases to external commands. In addition to waiting after clean like the previous commit, this also enables cleaning the child (that was already enabled for aliases to builtins before the previous commit), because wait_after_clean relies on it. Lastly, while the previous commit fixed a regression, I don't think this has ever worked properly.

Signed-off-by: Trygve Aaberge <trygveaa@gmail.com>
---
 git.c | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/git.c b/git.c
index 9b8d3c92e6..c0698c7d45 100644
--- a/git.c
+++ b/git.c
@@ -345,6 +345,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);
-- 
2.26.2.2.g2208536367
Previous: trygveaa@gmail.com
Message 13 of 13 in “Wait for child on signal death for aliases to builtins”
  1. 1/2 Wait for child on signal death for aliases to builtinstrygveaa@gmail.com, Jul 4, 2020
  2. 2/2 Wait for child on signal death for aliases to externalstrygveaa@gmail.com, Jul 4, 2020
  3. Jeff KingJul 6, 2020
  4. Junio C HamanoJul 7, 2020
  5. Trygve AabergeJul 7, 2020
  6. Jeff KingJul 7, 2020
  7. Johannes SchindelinJul 5, 2020
  8. Junio C HamanoJul 7, 2020
  9. Jeff KingJul 6, 2020
  10. Junio C HamanoJul 7, 2020
  11. Trygve AabergeJul 7, 2020
  12. 1/2 Wait for child on signal death for aliases to builtinstrygveaa@gmail.com, Jul 7, 2020
  13. 2/2 Wait for child on signal death for aliases to externalstrygveaa@gmail.com, Jul 7, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.