i3bar: kill child processes when exit()ing (they might be stopped) (Thanks darkraven)
This commit is contained in:
parent
941267e98e
commit
d519659ea7
|
@ -21,7 +21,13 @@
|
|||
void start_child(char *command);
|
||||
|
||||
/*
|
||||
* kill()s the child-prozess (if existend) and closes and
|
||||
* kill()s the child-process (if any). Called when exit()ing.
|
||||
*
|
||||
*/
|
||||
void kill_child_at_exit();
|
||||
|
||||
/*
|
||||
* kill()s the child-process (if any) and closes and
|
||||
* free()s the stdin- and sigchild-watchers
|
||||
*
|
||||
*/
|
||||
|
|
|
@ -311,6 +311,18 @@ void start_child(char *command) {
|
|||
ev_child_init(child_sig, &child_sig_cb, child_pid, 0);
|
||||
ev_child_start(main_loop, child_sig);
|
||||
|
||||
atexit(kill_child_at_exit);
|
||||
}
|
||||
|
||||
/*
|
||||
* kill()s the child-process (if any). Called when exit()ing.
|
||||
*
|
||||
*/
|
||||
void kill_child_at_exit() {
|
||||
if (child_pid != 0) {
|
||||
kill(child_pid, SIGCONT);
|
||||
kill(child_pid, SIGTERM);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue