mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03: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 (
|
import (
|
||||||
"os"
|
"os"
|
||||||
"syscall"
|
|
||||||
|
|
||||||
"github.com/docker/libcontainer/cgroups"
|
"github.com/docker/libcontainer/cgroups"
|
||||||
"github.com/docker/libcontainer/configs"
|
"github.com/docker/libcontainer/configs"
|
||||||
@@ -26,7 +25,7 @@ type Container interface {
|
|||||||
// Returns the ID of the container
|
// Returns the ID of the container
|
||||||
ID() string
|
ID() string
|
||||||
|
|
||||||
// Returns the current statusof the container.
|
// Returns the current status of the container.
|
||||||
//
|
//
|
||||||
// errors:
|
// errors:
|
||||||
// Systemerror - System error.
|
// Systemerror - System error.
|
||||||
@@ -97,13 +96,6 @@ type Container interface {
|
|||||||
// Systemerror - System error.
|
// Systemerror - System error.
|
||||||
Signal(signal os.Signal) 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.
|
// OOM returns a read-only channel signaling when the container receives an OOM notification.
|
||||||
//
|
//
|
||||||
// errors:
|
// errors:
|
||||||
|
|||||||
@@ -295,16 +295,6 @@ func (c *linuxContainer) Signal(signal os.Signal) error {
|
|||||||
panic("not implemented")
|
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) {
|
func (c *linuxContainer) OOM() (<-chan struct{}, error) {
|
||||||
return NotifyOnOOM(c.state)
|
return NotifyOnOOM(c.state)
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-3
@@ -94,17 +94,22 @@ func execAction(context *cli.Context) {
|
|||||||
Stderr: os.Stderr,
|
Stderr: os.Stderr,
|
||||||
}
|
}
|
||||||
tty.attach(process)
|
tty.attach(process)
|
||||||
if _, err := container.Start(process); err != nil {
|
pid, err := container.Start(process)
|
||||||
|
if err != nil {
|
||||||
fatal(err)
|
fatal(err)
|
||||||
}
|
}
|
||||||
status, err := container.Wait()
|
proc, err := os.FindProcess(pid)
|
||||||
|
if err != nil {
|
||||||
|
fatal(err)
|
||||||
|
}
|
||||||
|
status, err := proc.Wait()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fatal(err)
|
fatal(err)
|
||||||
}
|
}
|
||||||
if err := container.Destroy(); err != nil {
|
if err := container.Destroy(); err != nil {
|
||||||
fatal(err)
|
fatal(err)
|
||||||
}
|
}
|
||||||
exit(status)
|
exit(status.Sys().(syscall.WaitStatus))
|
||||||
}
|
}
|
||||||
|
|
||||||
func exit(status syscall.WaitStatus) {
|
func exit(status syscall.WaitStatus) {
|
||||||
|
|||||||
Reference in New Issue
Block a user