mirror of https://github.com/docker/docs.git
Update libcontainer to 2d3b5af7486f1a4e80a5ed91859d309b4eebf80c
This revision is from docker_1.5 branch, because we don't want to introduce user namespace in docker 1.5, but fix for --pid=host is needed. Fixes #10303 Signed-off-by: Alexander Morozov <lk4d4@docker.com>
This commit is contained in:
parent
99bffdf10e
commit
fd2d45d7d4
|
@ -68,7 +68,8 @@ if [ "$1" = '--go' ]; then
|
||||||
mv tmp-tar src/code.google.com/p/go/src/pkg/archive/tar
|
mv tmp-tar src/code.google.com/p/go/src/pkg/archive/tar
|
||||||
fi
|
fi
|
||||||
|
|
||||||
clone git github.com/docker/libcontainer eb74393a3d2daeafbef4f5f27c0821cbdd67559c
|
# this commit is from docker_1.5 branch in libcontainer, pls delete that branch when you'll update libcontainer again
|
||||||
|
clone git github.com/docker/libcontainer 2d3b5af7486f1a4e80a5ed91859d309b4eebf80c
|
||||||
# see src/github.com/docker/libcontainer/update-vendor.sh which is the "source of truth" for libcontainer deps (just like this file)
|
# see src/github.com/docker/libcontainer/update-vendor.sh which is the "source of truth" for libcontainer deps (just like this file)
|
||||||
rm -rf src/github.com/docker/libcontainer/vendor
|
rm -rf src/github.com/docker/libcontainer/vendor
|
||||||
eval "$(grep '^clone ' src/github.com/docker/libcontainer/update-vendor.sh | grep -v 'github.com/codegangsta/cli')"
|
eval "$(grep '^clone ' src/github.com/docker/libcontainer/update-vendor.sh | grep -v 'github.com/codegangsta/cli')"
|
||||||
|
|
|
@ -50,10 +50,20 @@ func Exec(container *libcontainer.Config, stdin io.Reader, stdout, stderr io.Wri
|
||||||
}
|
}
|
||||||
child.Close()
|
child.Close()
|
||||||
|
|
||||||
|
wait := func() (*os.ProcessState, error) {
|
||||||
|
ps, err := command.Process.Wait()
|
||||||
|
// we should kill all processes in cgroup when init is died if we use
|
||||||
|
// host PID namespace
|
||||||
|
if !container.Namespaces.Contains(libcontainer.NEWPID) {
|
||||||
|
killAllPids(container)
|
||||||
|
}
|
||||||
|
return ps, err
|
||||||
|
}
|
||||||
|
|
||||||
terminate := func(terr error) (int, error) {
|
terminate := func(terr error) (int, error) {
|
||||||
// TODO: log the errors for kill and wait
|
// TODO: log the errors for kill and wait
|
||||||
command.Process.Kill()
|
command.Process.Kill()
|
||||||
command.Wait()
|
wait()
|
||||||
return -1, terr
|
return -1, terr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,16 +119,16 @@ func Exec(container *libcontainer.Config, stdin io.Reader, stdout, stderr io.Wri
|
||||||
startCallback()
|
startCallback()
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := command.Wait(); err != nil {
|
ps, err := wait()
|
||||||
|
if err != nil {
|
||||||
if _, ok := err.(*exec.ExitError); !ok {
|
if _, ok := err.(*exec.ExitError); !ok {
|
||||||
return -1, err
|
return -1, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !container.Namespaces.Contains(libcontainer.NEWPID) {
|
// waiting for pipe flushing
|
||||||
killAllPids(container)
|
command.Wait()
|
||||||
}
|
|
||||||
|
|
||||||
waitStatus := command.ProcessState.Sys().(syscall.WaitStatus)
|
waitStatus := ps.Sys().(syscall.WaitStatus)
|
||||||
if waitStatus.Signaled() {
|
if waitStatus.Signaled() {
|
||||||
return EXIT_SIGNAL_OFFSET + int(waitStatus.Signal()), nil
|
return EXIT_SIGNAL_OFFSET + int(waitStatus.Signal()), nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue