runsc: Fix a bug that runsc wait doesn't work after container exits.

PiperOrigin-RevId: 213849165
Change-Id: I5120b2f568850c0c42a08e8706e7f8653ef1bd94
This commit is contained in:
Lantao Liu
2018-09-20 11:23:26 -07:00
committed by Shentubot
parent ffb5fdd690
commit 9464b82a06
+1 -1
View File
@@ -139,6 +139,7 @@ func Load(rootDir, id string) (*Container, error) {
if !c.Sandbox.IsRunning() {
// Sandbox no longer exists, so this container definitely does not exist.
c.changeStatus(Stopped)
c.Sandbox = nil
} else if c.Status == Running {
// Container state should reflect the actual state of
// the application, so we don't consider gofer process
@@ -682,7 +683,6 @@ func (c *Container) changeStatus(s Status) {
if c.Status != Created && c.Status != Running && c.Status != Stopped {
panic(fmt.Sprintf("invalid state transition: %v => %v", c.Status, s))
}
c.Sandbox = nil
default:
panic(fmt.Sprintf("invalid new state: %v", s))