mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
runsc: allow runsc wait on a container for multiple times.
PiperOrigin-RevId: 213908919 Change-Id: I74eff99a5360bb03511b946f4cb5658bb5fc40c7
This commit is contained in:
@@ -573,15 +573,8 @@ func (l *Loader) waitContainer(cid string, waitStatus *uint32) error {
|
||||
|
||||
// If the thread either has already exited or exits during waiting,
|
||||
// consider the container exited.
|
||||
// TODO: Multiple calls to waitContainer() should return
|
||||
// the same exit status.
|
||||
ws := l.wait(tg)
|
||||
*waitStatus = ws
|
||||
|
||||
l.mu.Lock()
|
||||
defer l.mu.Unlock()
|
||||
delete(l.containerRootTGs, cid)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -152,8 +152,8 @@ func TestMultiContainerWait(t *testing.T) {
|
||||
} else if es := ws.ExitStatus(); es != 0 {
|
||||
t.Errorf("process %s exited with non-zero status %d", c.Spec.Process.Args, es)
|
||||
}
|
||||
if _, err := c.Wait(); err == nil {
|
||||
t.Errorf("wait for stopped process %s should fail", c.Spec.Process.Args)
|
||||
if _, err := c.Wait(); err != nil {
|
||||
t.Errorf("wait for stopped container %s shouldn't fail: %v", c.Spec.Process.Args, err)
|
||||
}
|
||||
}(containers[1])
|
||||
}
|
||||
@@ -239,8 +239,8 @@ func TestExecWait(t *testing.T) {
|
||||
} else if es := ws.ExitStatus(); es != 0 {
|
||||
t.Fatalf("process %s exited with non-zero status %d", containers[1].Spec.Process.Args, es)
|
||||
}
|
||||
if _, err := containers[1].Wait(); err == nil {
|
||||
t.Fatalf("wait for stopped process %s should fail", containers[1].Spec.Process.Args)
|
||||
if _, err := containers[1].Wait(); err != nil {
|
||||
t.Fatalf("wait for stopped container %s shouldn't fail: %v", containers[1].Spec.Process.Args, err)
|
||||
}
|
||||
|
||||
// Execute another process in the first container.
|
||||
|
||||
Reference in New Issue
Block a user