From ac2fbaa674ce3d5b5faf6a83f88cc4af1654f9cd Mon Sep 17 00:00:00 2001 From: Lars Schneider Date: Sun, 16 Oct 2016 16:20:28 -0700 Subject: run-command: add clean_on_exit_handler Some processes might want to perform cleanup tasks before Git kills them due to the 'clean_on_exit' flag. Let's give them an interface for doing this. The feature is used in a subsequent patch. Please note, that the cleanup callback is not executed if Git dies of a signal. The reason is that only "async-signal-safe" functions would be allowed to be call in that case. Since we cannot control what functions the callback will use, we will not support the case. See 507d7804 for more details. Helped-by: Johannes Sixt Signed-off-by: Lars Schneider Signed-off-by: Junio C Hamano --- run-command.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'run-command.h') diff --git a/run-command.h b/run-command.h index cf29a3195a..dd1c78c28d 100644 --- a/run-command.h +++ b/run-command.h @@ -43,6 +43,8 @@ struct child_process { unsigned stdout_to_stderr:1; unsigned use_shell:1; unsigned clean_on_exit:1; + void (*clean_on_exit_handler)(struct child_process *process); + void *clean_on_exit_handler_cbdata; }; #define CHILD_PROCESS_INIT { NULL, ARGV_ARRAY_INIT, ARGV_ARRAY_INIT } -- cgit v1.2.3