diff options
author | Jeff King <peff@peff.net> | 2012-01-07 12:42:43 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-01-08 15:06:35 -0800 |
commit | afe19ff7b55129d988e421ae1e0df4ec9659787a (patch) | |
tree | b751bccbe3d1ec95451b26a26d3a775193fc65c6 /builtin/merge-ours.c | |
parent | Git 1.7.9-rc0 (diff) | |
download | tgif-afe19ff7b55129d988e421ae1e0df4ec9659787a.tar.xz |
run-command: optionally kill children on exit
When we spawn a helper process, it should generally be done
and finish_command called before we exit. However, if we
exit abnormally due to an early return or a signal, the
helper may continue to run in our absence.
In the best case, this may simply be wasted CPU cycles or a
few stray messages on a terminal. But it could also mean a
process that the user thought was aborted continues to run
to completion (e.g., a push's pack-objects helper will
complete the push, even though you killed the push process).
This patch provides infrastructure for run-command to keep
track of PIDs to be killed, and clean them on signal
reception or input, just as we do with tempfiles. PIDs can
be added in two ways:
1. If NO_PTHREADS is defined, async helper processes are
automatically marked. By definition this code must be
ready to die when the parent dies, since it may be
implemented as a thread of the parent process.
2. If the run-command caller specifies the "clean_on_exit"
option. This is not the default, as there are cases
where it is OK for the child to outlive us (e.g., when
spawning a pager).
PIDs are cleared from the kill-list automatically during
wait_or_whine, which is called from finish_command and
finish_async.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/merge-ours.c')
0 files changed, 0 insertions, 0 deletions