Follow termination of our children only

This commit is contained in:
Mehdi Abaakouk 2016-08-03 00:50:39 +02:00
parent 972603c38b
commit af4dd073cd
1 changed files with 11 additions and 8 deletions

View File

@ -267,12 +267,15 @@ class ServiceManager(object):
os.killpg(0, signal.SIGTERM)
LOG.debug("Waiting services to terminate")
while True:
# NOTE(sileht): We follow the termination of our children only
# so we can't use waitpid(0, 0)
for conf in self._services:
for pid in self._running_services[conf]:
try:
os.waitpid(0, 0)
os.waitpid(pid, 0)
except OSError as e:
if e.errno == errno.ECHILD:
break
pass
else:
raise