Re: [PATCH 1/5] run-command: optionally kill children on exit
- From
Erik Faye-Lund <kusmabite@gmail.com>
- Date
- Jan 7, 2012, 12:45 UTC
- Message-ID
- <CABPQNSb57LA6dYJvT7xF_vFfBFqKhCMbrQYp49_Ko1WmbUnYPw@mail.gmail.com>
- In-Reply-To
- <1325936567-3136-2-git-send-email-drizzd@aon.at>
On Sat, Jan 7, 2012 at 12:42 PM, Clemens Buchacher <drizzd@aon.at> wrote:
Show 17 quoted lines
> +static void cleanup_children(int sig)
> +{
> + while (children_to_clean) {
> + struct child_to_clean *p = children_to_clean;
> + children_to_clean = p->next;
> + kill(p->pid, sig);
> + free(p);
> + }
> +}
> +
> +static void cleanup_children_on_signal(int sig)
> +{
> + cleanup_children(sig);
> + sigchain_pop(sig);
> + raise(sig);
> +}
> +Our Windows implementation of kill (mingw_kill in compat/mingw.c) only supports SIGKILL, so propagating other signals to child-processes will fail with EINVAL. That being said, Windows' support for signals is severely limited, but I'm not entirely sure which ones can be generated in this case.
Show 8 quoted lines
> @@ -312,6 +375,7 @@ fail_pipe:
> cmd->pid = -1;
> }
> close(notify_pipe[0]);
> +
> }
> #else
> {This hunk is probably unintentional...