Lars Schneider <larsxschneider@xxxxxxxxx> 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?