From 52a1dfb4184793fdf797bf6f2b5896c2d63e2465 Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Mon, 14 Mar 2016 16:31:14 -0700 Subject: [PATCH] Call delete before closing IO in shim Signed-off-by: Michael Crosby --- containerd-shim/main.go | 5 ++--- supervisor/sort_test.go | 4 ++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/containerd-shim/main.go b/containerd-shim/main.go index c1b78ca7d..4ca4101fc 100644 --- a/containerd-shim/main.go +++ b/containerd-shim/main.go @@ -58,11 +58,9 @@ func main() { if err := p.Close(); err != nil { logrus.WithField("error", err).Error("shim: close stdio") } - if err := p.delete(); err != nil { - logrus.WithField("error", err).Error("shim: delete runtime state") - } }() if err := p.start(); err != nil { + p.delete() logrus.WithField("error", err).Error("shim: start process") return } @@ -117,6 +115,7 @@ func main() { } // runtime has exited so the shim can also exit if exitShim { + p.delete() p.Wait() return } diff --git a/supervisor/sort_test.go b/supervisor/sort_test.go index 905bce00a..2fd868024 100644 --- a/supervisor/sort_test.go +++ b/supervisor/sort_test.go @@ -57,6 +57,10 @@ func (p *testProcess) Close() error { return nil } +func (p *testProcess) State() runtime.State { + return runtime.Running +} + func TestSortProcesses(t *testing.T) { p := []runtime.Process{ &testProcess{"ls"},