mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-09 03:57:41 +00:00
Cleanup leaking goroutine
This commit is contained in:
parent
7747f5eefd
commit
fa15c87cf0
@ -49,25 +49,10 @@ func (r *streamingRuntime) exec(containerID string, cmd []string, in io.Reader,
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(timstclair): Clean this up once PR#33366 merges.
|
// TODO(timstclair): Add timeout once PR#33366 merges.
|
||||||
if timeout <= 0 {
|
|
||||||
// Run until command exits.
|
|
||||||
return r.execHandler.ExecInContainer(r.client, container, cmd, in, out, errw, tty, resize)
|
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)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *streamingRuntime) Attach(containerID string, in io.Reader, out, errw io.WriteCloser, resize <-chan term.Size) error {
|
func (r *streamingRuntime) Attach(containerID string, in io.Reader, out, errw io.WriteCloser, resize <-chan term.Size) error {
|
||||||
container, err := checkContainerStatus(r.client, containerID)
|
container, err := checkContainerStatus(r.client, containerID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user