Merge pull request #406 from LK4D4/return_state_on_err

Return actual ProcessState on Wait error
This commit is contained in:
Mrunal Patel 2015-02-25 13:18:18 -08:00
commit fff015f409
1 changed files with 2 additions and 2 deletions

View File

@ -111,7 +111,7 @@ func (p *setnsProcess) terminate() error {
func (p *setnsProcess) wait() (*os.ProcessState, error) { func (p *setnsProcess) wait() (*os.ProcessState, error) {
err := p.cmd.Wait() err := p.cmd.Wait()
if err != nil { if err != nil {
return nil, err return p.cmd.ProcessState, err
} }
return p.cmd.ProcessState, nil return p.cmd.ProcessState, nil
@ -172,7 +172,7 @@ func (p *initProcess) start() error {
func (p *initProcess) wait() (*os.ProcessState, error) { func (p *initProcess) wait() (*os.ProcessState, error) {
err := p.cmd.Wait() err := p.cmd.Wait()
if err != nil { if err != nil {
return nil, err return p.cmd.ProcessState, err
} }
// we should kill all processes in cgroup when init is died if we use host PID namespace // we should kill all processes in cgroup when init is died if we use host PID namespace
if p.cmd.SysProcAttr.Cloneflags&syscall.CLONE_NEWPID == 0 { if p.cmd.SysProcAttr.Cloneflags&syscall.CLONE_NEWPID == 0 {