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

[PATCH] run-command.c: ensure signaled hook scripts are waited upon

From
Anthony Sottile <asottile@umich.edu>
Date
Feb 21, 2020, 06:06 UTC
Message-ID
<20200221060636.4507-1-asottile@umich.edu>

In the event of a `^C` while hook scripts are running, ensure that the hook processes are cleaned up and do not become zombies. This also ensures that upon `^C` execution is not handed back to the terminal until the processes have been waited upon.

Signed-off-by: Anthony Sottile <asottile@umich.edu>
---
 run-command.c | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/run-command.c b/run-command.c
index f5e1149..75d3b73 100644
--- a/run-command.c
+++ b/run-command.c
@@ -1358,6 +1358,8 @@ int run_hook_ve(const char *const *env, const char *name, va_list args)
 	hook.no_stdin = 1;
 	hook.stdout_to_stderr = 1;
 	hook.trace2_hook_name = name;
+	hook.clean_on_exit = 1;
+	hook.wait_after_clean = 1;
 
 	return run_command(&hook);
 }
-- 
2.25.GIT
Next: Jeff King
Message 1 of 3 in “run-command.c: ensure signaled hook scripts are waited upon”
  1. run-command.c: ensure signaled hook scripts are waited uponAnthony Sottile, Feb 21, 2020
  2. Jeff KingFeb 21, 2020
  3. Junio C HamanoFeb 22, 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.