Cleanup leaking goroutine

This commit is contained in:
Tim St. Clair 2016-11-02 15:08:21 -07:00
parent 7747f5eefd
commit fa15c87cf0
No known key found for this signature in database
GPG Key ID: 434D16BCEF479EAB

View File

@ -49,23 +49,8 @@ func (r *streamingRuntime) exec(containerID string, cmd []string, in io.Reader,
return err
}
// TODO(timstclair): Clean this up once PR#33366 merges.
if timeout <= 0 {
// Run until command exits.
return r.execHandler.ExecInContainer(r.client, container, cmd, in, out, errw, tty, resize)
}
errCh := make(chan error)
go func() {
errCh <- r.execHandler.ExecInContainer(r.client, container, cmd, in, out, errw, tty, resize)
}()
select {
case err := <-errCh:
return err
case <-time.After(timeout):
return streaming.ErrorTimeout("exec", timeout)
}
// TODO(timstclair): Add timeout once PR#33366 merges.
return r.execHandler.ExecInContainer(r.client, container, cmd, in, out, errw, tty, resize)
}
func (r *streamingRuntime) Attach(containerID string, in io.Reader, out, errw io.WriteCloser, resize <-chan term.Size) error {