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:
Michael Crosby 2015-02-03 10:50:18 -08:00
parent bcd0222be5
commit ab76a88d6b
4 changed files with 10 additions and 22 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
nsinit/nsinit

View File

@ -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:

View File

@ -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)
}

View File

@ -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) {