Allow exec process to be deleted in created state

Fixes #1376

This allows an exec process to be deleted in the created state.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby
2017-08-17 14:50:30 -04:00
parent 873a34649a
commit bf82de3a4e
3 changed files with 86 additions and 3 deletions

View File

@@ -59,6 +59,9 @@ func (p *process) Status() runtime.Status {
case <-p.exitCh:
status = runtime.StoppedStatus
default:
if p.hcs == nil {
return runtime.CreatedStatus
}
status = runtime.RunningStatus
}
return status
@@ -83,8 +86,8 @@ func (p *process) Pid() uint32 {
}
func (p *process) ExitCode() (uint32, time.Time, error) {
if p.Status() != runtime.StoppedStatus {
return 255, time.Time{}, errors.Wrap(errdefs.ErrFailedPrecondition, "process is not stopped")
if s := p.Status(); s != runtime.StoppedStatus && s != runtime.CreatedStatus {
return 255, time.Time{}, errors.Wrapf(errdefs.ErrFailedPrecondition, "process is not stopped: %s", s)
}
return p.exitCode, p.exitTime, nil
}