mirror of https://github.com/docker/docs.git
Merge pull request #6062 from crosbymichael/update-waits
Update wait calls to call Wait on Command
This commit is contained in:
commit
b8a89ba963
|
@ -167,6 +167,7 @@ func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallba
|
||||||
waitErr error
|
waitErr error
|
||||||
waitLock = make(chan struct{})
|
waitLock = make(chan struct{})
|
||||||
)
|
)
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
if err := c.Wait(); err != nil {
|
if err := c.Wait(); err != nil {
|
||||||
if _, ok := err.(*exec.ExitError); !ok { // Do not propagate the error if it's simply a status code != 0
|
if _, ok := err.(*exec.ExitError); !ok { // Do not propagate the error if it's simply a status code != 0
|
||||||
|
@ -181,10 +182,11 @@ func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallba
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if c.Process != nil {
|
if c.Process != nil {
|
||||||
c.Process.Kill()
|
c.Process.Kill()
|
||||||
c.Process.Wait()
|
c.Wait()
|
||||||
}
|
}
|
||||||
return -1, err
|
return -1, err
|
||||||
}
|
}
|
||||||
|
|
||||||
c.ContainerPid = pid
|
c.ContainerPid = pid
|
||||||
|
|
||||||
if startCallback != nil {
|
if startCallback != nil {
|
||||||
|
|
|
@ -56,7 +56,7 @@ func Exec(container *libcontainer.Container, term Terminal, rootfs, dataPath str
|
||||||
}
|
}
|
||||||
if err := WritePid(dataPath, command.Process.Pid, started); err != nil {
|
if err := WritePid(dataPath, command.Process.Pid, started); err != nil {
|
||||||
command.Process.Kill()
|
command.Process.Kill()
|
||||||
command.Process.Wait()
|
command.Wait()
|
||||||
return -1, err
|
return -1, err
|
||||||
}
|
}
|
||||||
defer DeletePid(dataPath)
|
defer DeletePid(dataPath)
|
||||||
|
@ -66,7 +66,7 @@ func Exec(container *libcontainer.Container, term Terminal, rootfs, dataPath str
|
||||||
cleaner, err := SetupCgroups(container, command.Process.Pid)
|
cleaner, err := SetupCgroups(container, command.Process.Pid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
command.Process.Kill()
|
command.Process.Kill()
|
||||||
command.Process.Wait()
|
command.Wait()
|
||||||
return -1, err
|
return -1, err
|
||||||
}
|
}
|
||||||
if cleaner != nil {
|
if cleaner != nil {
|
||||||
|
@ -75,7 +75,7 @@ func Exec(container *libcontainer.Container, term Terminal, rootfs, dataPath str
|
||||||
|
|
||||||
if err := InitializeNetworking(container, command.Process.Pid, syncPipe); err != nil {
|
if err := InitializeNetworking(container, command.Process.Pid, syncPipe); err != nil {
|
||||||
command.Process.Kill()
|
command.Process.Kill()
|
||||||
command.Process.Wait()
|
command.Wait()
|
||||||
return -1, err
|
return -1, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -126,9 +126,7 @@ func RestoreParentDeathSignal(old int) error {
|
||||||
// Signal self if parent is already dead. Does nothing if running in a new
|
// Signal self if parent is already dead. Does nothing if running in a new
|
||||||
// PID namespace, as Getppid will always return 0.
|
// PID namespace, as Getppid will always return 0.
|
||||||
if syscall.Getppid() == 1 {
|
if syscall.Getppid() == 1 {
|
||||||
err := syscall.Kill(syscall.Getpid(), syscall.Signal(old))
|
return syscall.Kill(syscall.Getpid(), syscall.SIGKILL)
|
||||||
syscall.Wait4(syscall.Getpid(), nil, 0, nil)
|
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in New Issue