mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-10 21:53:57 +08:00
Remove Wait() on container interface
Since we return the pid for the started process we do not need this method on the interface. Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
@@ -0,0 +1 @@
|
||||
nsinit/nsinit
|
||||
+1
-9
@@ -5,7 +5,6 @@ package libcontainer
|
||||
|
||||
import (
|
||||
"os"
|
||||
"syscall"
|
||||
|
||||
"github.com/docker/libcontainer/cgroups"
|
||||
"github.com/docker/libcontainer/configs"
|
||||
@@ -26,7 +25,7 @@ type Container interface {
|
||||
// Returns the ID of the container
|
||||
ID() string
|
||||
|
||||
// Returns the current statusof the container.
|
||||
// Returns the current status of the container.
|
||||
//
|
||||
// errors:
|
||||
// Systemerror - System error.
|
||||
@@ -97,13 +96,6 @@ type Container interface {
|
||||
// Systemerror - System error.
|
||||
Signal(signal os.Signal) error
|
||||
|
||||
// Wait waits for the init process of the conatiner to die and returns it's exit status.
|
||||
//
|
||||
// errors:
|
||||
// ContainerDestroyed - Container no longer exists,
|
||||
// Systemerror - System error.
|
||||
Wait() (exitStatus syscall.WaitStatus, err error)
|
||||
|
||||
// OOM returns a read-only channel signaling when the container receives an OOM notification.
|
||||
//
|
||||
// errors:
|
||||
|
||||
@@ -295,16 +295,6 @@ func (c *linuxContainer) Signal(signal os.Signal) error {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
func (c *linuxContainer) Wait() (syscall.WaitStatus, error) {
|
||||
var status syscall.WaitStatus
|
||||
// TODO : close exec.Cmd pipes, fix in master
|
||||
_, err := syscall.Wait4(c.state.InitPid, &status, 0, nil)
|
||||
if err != nil {
|
||||
return 0, newGenericError(err, SystemError)
|
||||
}
|
||||
return status, err
|
||||
}
|
||||
|
||||
func (c *linuxContainer) OOM() (<-chan struct{}, error) {
|
||||
return NotifyOnOOM(c.state)
|
||||
}
|
||||
|
||||
+8
-3
@@ -94,17 +94,22 @@ func execAction(context *cli.Context) {
|
||||
Stderr: os.Stderr,
|
||||
}
|
||||
tty.attach(process)
|
||||
if _, err := container.Start(process); err != nil {
|
||||
pid, err := container.Start(process)
|
||||
if err != nil {
|
||||
fatal(err)
|
||||
}
|
||||
status, err := container.Wait()
|
||||
proc, err := os.FindProcess(pid)
|
||||
if err != nil {
|
||||
fatal(err)
|
||||
}
|
||||
status, err := proc.Wait()
|
||||
if err != nil {
|
||||
fatal(err)
|
||||
}
|
||||
if err := container.Destroy(); err != nil {
|
||||
fatal(err)
|
||||
}
|
||||
exit(status)
|
||||
exit(status.Sys().(syscall.WaitStatus))
|
||||
}
|
||||
|
||||
func exit(status syscall.WaitStatus) {
|
||||
|
||||
Reference in New Issue
Block a user