func waitProcess(p *libcontainer.Process, t *testing.T) { status, err := p.Wait() ok(t, err) if !status.Success() { t.Fatal(status) } }
func waitInPIDHost(p *libcontainer.Process, c libcontainer.Container) func() (*os.ProcessState, error) { return func() (*os.ProcessState, error) { pid, err := p.Pid() if err != nil { return nil, err } process, err := os.FindProcess(pid) s, err := process.Wait() if err != nil { if err, ok := err.(*exec.ExitError); !ok { return s, err } else { s = err.ProcessState } } processes, err := c.Processes() if err != nil { return s, err } for _, pid := range processes { process, err := os.FindProcess(pid) if err != nil { log.Errorf("Failed to kill process: %d", pid) continue } process.Kill() } p.Wait() return s, err } }
func waitProcess(p *libcontainer.Process, t *testing.T) { _, file, line, _ := runtime.Caller(1) status, err := p.Wait() if err != nil { t.Fatalf("%s:%d: unexpected error: %s\n\n", filepath.Base(file), line, err.Error()) } if !status.Success() { t.Fatalf("%s:%d: unexpected status: %s\n\n", filepath.Base(file), line, status.String()) } }
func waitInPIDHost(p *libcontainer.Process, c libcontainer.Container) func() (*os.ProcessState, error) { return func() (*os.ProcessState, error) { pid, err := p.Pid() if err != nil { return nil, err } process, err := os.FindProcess(pid) s, err := process.Wait() if err != nil { execErr, ok := err.(*exec.ExitError) if !ok { return s, err } s = execErr.ProcessState } killCgroupProcs(c) p.Wait() return s, err } }