Wait all children, not only the first one

This commit is contained in:
Mehdi Abaakouk 2016-07-06 02:25:24 +02:00
parent a55a08b840
commit e2cc2a633c
2 changed files with 7 additions and 1 deletions

View File

@ -307,7 +307,11 @@ class ServiceManager(object):
os.killpg(0, signal.SIGTERM)
LOG.debug("Waiting services to terminate")
os.waitpid(-1, 0)
while True:
try:
os.waitpid(0, 0)
except OSError:
break
LOG.debug("Shutdown finish")
_logged_sys_exit(0)

View File

@ -140,6 +140,8 @@ class TestCotyledon(base.TestCase):
os.kill(self.subp.pid, signal.SIGTERM)
self.subp.terminate()
lines = self.get_lines()
self.assertEqual(b'DEBUG:cotyledon:Shutdown finish',
lines[-1])
time.sleep(0.5)
lines = sorted(self.hide_pids(lines))
self.assertEqual([