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:
@@ -39,12 +39,13 @@ func (p *process) ID() string {
|
||||
|
||||
func (p *process) State(ctx context.Context) (runtime.State, error) {
|
||||
return runtime.State{
|
||||
Status: p.Status(),
|
||||
Pid: p.pid,
|
||||
Stdin: p.io.src.Stdin,
|
||||
Stdout: p.io.src.Stdout,
|
||||
Stderr: p.io.src.Stderr,
|
||||
Terminal: p.io.src.Terminal,
|
||||
Status: p.Status(),
|
||||
Pid: p.pid,
|
||||
Stdin: p.io.src.Stdin,
|
||||
Stdout: p.io.src.Stdout,
|
||||
Stderr: p.io.src.Stderr,
|
||||
Terminal: p.io.src.Terminal,
|
||||
ExitStatus: p.exitCode,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user