Wait for all exec process child before exiting from shim

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
This commit is contained in:
Kenfe-Mickael Laventure 2016-09-12 11:22:48 -07:00
parent 920a9c21d7
commit 18c76025a1
2 changed files with 10 additions and 3 deletions

View file

@ -106,7 +106,7 @@ func start(log *os.File) error {
case s := <-signals:
switch s {
case syscall.SIGCHLD:
exits, _ := osutils.Reap()
exits, _ := osutils.Reap(false)
for _, e := range exits {
// check to see if runtime is one of the processes that has exited
if e.Pid == p.pid() {
@ -117,6 +117,9 @@ func start(log *os.File) error {
}
// runtime has exited so the shim can also exit
if exitShim {
// Wait for all the childs this process may have created
// (only needed for exec, but it won't hurt when done on init)
osutils.Reap(true)
// Let containerd take care of calling the runtime delete
f.Close()
p.Wait()