From: Junio C Hamano Date: Wed, 05 Oct 2016 21:12:42 GMT Subject: Re: [PATCH v9 04/14] run-command: add wait_on_exit Message-ID: In-Reply-To: <1FD7FB64-0F40-47F0-A047-25B91B170E66@gmail.com> Lars Schneider writes: > OK. Something like the patch below would work nicely. Yeah, something along that line; it would eliminate the need to worry about a field named "stdin" ;-) But ... > while (children_to_clean) { > struct child_to_clean *p = children_to_clean; > children_to_clean = p->next; > + > + if (p->clean_on_exit_handler) { > + p->clean_on_exit_handler(p->pid, in_signal); > + } ... the application that used run_command() API would want to be able to pass extra piece of data that is appliation-specific for the child being killed, so it may make sense to extend the function signature to take a pointer to "struct child_process" for the child process being killed, together with a new field added to "struct child_process" that is "void *exit_handler_cbdata;", perhaps?