Skip to content

Commit 10c6cdd

Browse files
Clemens Buchachergitster
Clemens Buchacher
authored andcommitted
dashed externals: kill children on exit
Several git commands are so-called dashed externals, that is commands executed as a child process of the git wrapper command. If the git wrapper is killed by a signal, the child process will continue to run. This is different from internal commands, which always die with the git wrapper command. Enable the recently introduced cleanup mechanism for child processes in order to make dashed externals act more in line with internal commands. Signed-off-by: Clemens Buchacher <drizzd@aon.at> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent afe19ff commit 10c6cdd

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

git.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ static void execv_dashed_external(const char **argv)
495495
* if we fail because the command is not found, it is
496496
* OK to return. Otherwise, we just pass along the status code.
497497
*/
498-
status = run_command_v_opt(argv, RUN_SILENT_EXEC_FAILURE);
498+
status = run_command_v_opt(argv, RUN_SILENT_EXEC_FAILURE | RUN_CLEAN_ON_EXIT);
499499
if (status >= 0 || errno != ENOENT)
500500
exit(status);
501501

run-command.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,7 @@ static void prepare_run_command_v_opt(struct child_process *cmd,
497497
cmd->stdout_to_stderr = opt & RUN_COMMAND_STDOUT_TO_STDERR ? 1 : 0;
498498
cmd->silent_exec_failure = opt & RUN_SILENT_EXEC_FAILURE ? 1 : 0;
499499
cmd->use_shell = opt & RUN_USING_SHELL ? 1 : 0;
500+
cmd->clean_on_exit = opt & RUN_CLEAN_ON_EXIT ? 1 : 0;
500501
}
501502

502503
int run_command_v_opt(const char **argv, int opt)

run-command.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ extern int run_hook(const char *index_file, const char *name, ...);
5353
#define RUN_COMMAND_STDOUT_TO_STDERR 4
5454
#define RUN_SILENT_EXEC_FAILURE 8
5555
#define RUN_USING_SHELL 16
56+
#define RUN_CLEAN_ON_EXIT 32
5657
int run_command_v_opt(const char **argv, int opt);
5758

5859
/*

0 commit comments

Comments
 (0)