mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #11933 from LK4D4/fix_err_mask
Various fixes for execdriver
This commit is contained in:
commit
f0ddbbaa86
1 changed files with 9 additions and 8 deletions
|
@ -162,18 +162,18 @@ func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallba
|
||||||
logrus.Warnf("Your kernel does not support OOM notifications: %s", err)
|
logrus.Warnf("Your kernel does not support OOM notifications: %s", err)
|
||||||
}
|
}
|
||||||
waitF := p.Wait
|
waitF := p.Wait
|
||||||
if nss := cont.Config().Namespaces; nss.Contains(configs.NEWPID) {
|
if nss := cont.Config().Namespaces; !nss.Contains(configs.NEWPID) {
|
||||||
// we need such hack for tracking processes with inerited fds,
|
// we need such hack for tracking processes with inerited fds,
|
||||||
// because cmd.Wait() waiting for all streams to be copied
|
// because cmd.Wait() waiting for all streams to be copied
|
||||||
waitF = waitInPIDHost(p, cont)
|
waitF = waitInPIDHost(p, cont)
|
||||||
}
|
}
|
||||||
ps, err := waitF()
|
ps, err := waitF()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err, ok := err.(*exec.ExitError); !ok {
|
execErr, ok := err.(*exec.ExitError)
|
||||||
|
if !ok {
|
||||||
return execdriver.ExitStatus{ExitCode: -1}, err
|
return execdriver.ExitStatus{ExitCode: -1}, err
|
||||||
} else {
|
|
||||||
ps = err.ProcessState
|
|
||||||
}
|
}
|
||||||
|
ps = execErr.ProcessState
|
||||||
}
|
}
|
||||||
cont.Destroy()
|
cont.Destroy()
|
||||||
|
|
||||||
|
@ -189,16 +189,17 @@ func waitInPIDHost(p *libcontainer.Process, c libcontainer.Container) func() (*o
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
processes, err := c.Processes()
|
||||||
|
|
||||||
process, err := os.FindProcess(pid)
|
process, err := os.FindProcess(pid)
|
||||||
s, err := process.Wait()
|
s, err := process.Wait()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err, ok := err.(*exec.ExitError); !ok {
|
execErr, ok := err.(*exec.ExitError)
|
||||||
|
if !ok {
|
||||||
return s, err
|
return s, err
|
||||||
} else {
|
|
||||||
s = err.ProcessState
|
|
||||||
}
|
}
|
||||||
|
s = execErr.ProcessState
|
||||||
}
|
}
|
||||||
processes, err := c.Processes()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return s, err
|
return s, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue