mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-22 14:42:40 +01:00
subd: if a required daemon exits, wait instead of killing it.
Otherwise we always say it died because we killed it, so we don't get the exit status. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
36746bf65a
commit
b83ac58a98
1 changed files with 7 additions and 2 deletions
|
@ -523,8 +523,13 @@ static void destroy_subd(struct subd *sd)
|
||||||
|
|
||||||
switch (waitpid(sd->pid, &status, WNOHANG)) {
|
switch (waitpid(sd->pid, &status, WNOHANG)) {
|
||||||
case 0:
|
case 0:
|
||||||
log_debug(sd->log, "Status closed, but not exited. Killing");
|
/* If it's an essential daemon, don't kill: we want the
|
||||||
|
* exit status */
|
||||||
|
if (!sd->must_not_exit) {
|
||||||
|
log_debug(sd->log,
|
||||||
|
"Status closed, but not exited. Killing");
|
||||||
kill(sd->pid, SIGKILL);
|
kill(sd->pid, SIGKILL);
|
||||||
|
}
|
||||||
waitpid(sd->pid, &status, 0);
|
waitpid(sd->pid, &status, 0);
|
||||||
fail_if_subd_fails = false;
|
fail_if_subd_fails = false;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Reference in a new issue