Return exit status from Wait of stopped process

This changes Wait() from returning an error whenever you call wait on a
stopped process/task to returning the exit status from the process.

This also adds the exit status to the Status() call on a process/task so
that a user can Wait(), check status, then cancel the wait to avoid
races in event handling.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby
2017-08-03 17:09:16 -04:00
parent 0fa76584f8
commit 9f13b414b9
16 changed files with 283 additions and 178 deletions

View File

@@ -49,15 +49,17 @@ func (p *Process) State(ctx context.Context) (runtime.State, error) {
status = runtime.StoppedStatus
case task.StatusPaused:
status = runtime.PausedStatus
// TODO: containerd.DeletedStatus
case task.StatusPausing:
status = runtime.PausingStatus
}
return runtime.State{
Pid: response.Pid,
Status: status,
Stdin: response.Stdin,
Stdout: response.Stdout,
Stderr: response.Stderr,
Terminal: response.Terminal,
Pid: response.Pid,
Status: status,
Stdin: response.Stdin,
Stdout: response.Stdout,
Stderr: response.Stderr,
Terminal: response.Terminal,
ExitStatus: response.ExitStatus,
}, nil
}