Merge pull request #1133 from lifupan/multiwait

shimv2: multi wait support for wait service
This commit is contained in:
Peng Tao 2019-01-18 12:12:39 +08:00 committed by GitHub
commit ea2086b45f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -728,12 +728,20 @@ func (s *service) Wait(ctx context.Context, r *taskAPI.WaitRequest) (*taskAPI.Wa
//wait for container //wait for container
if r.ExecID == "" { if r.ExecID == "" {
ret = <-c.exitCh ret = <-c.exitCh
// refill the exitCh with the container process's exit code in case
// there were other waits on this process.
c.exitCh <- ret
} else { //wait for exec } else { //wait for exec
execs, err := c.getExec(r.ExecID) execs, err := c.getExec(r.ExecID)
if err != nil { if err != nil {
return nil, err return nil, err
} }
ret = <-execs.exitCh ret = <-execs.exitCh
// refill the exitCh with the exec process's exit code in case
// there were other waits on this process.
execs.exitCh <- ret
} }
return &taskAPI.WaitResponse{ return &taskAPI.WaitResponse{