mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-21 14:24:09 +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)) {
|
||||
case 0:
|
||||
log_debug(sd->log, "Status closed, but not exited. Killing");
|
||||
kill(sd->pid, SIGKILL);
|
||||
/* 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);
|
||||
}
|
||||
waitpid(sd->pid, &status, 0);
|
||||
fail_if_subd_fails = false;
|
||||
break;
|
||||
|
|
Loading…
Add table
Reference in a new issue