From b2792dd76a7b62fcea072d91faf09d1bc8c18b61 Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Fri, 12 Jun 2020 07:49:28 -0400 Subject: Handle errors on attach properly Signed-off-by: Daniel J Walsh --- pkg/domain/infra/tunnel/containers.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'pkg/domain') diff --git a/pkg/domain/infra/tunnel/containers.go b/pkg/domain/infra/tunnel/containers.go index 4bd813847..955149fcf 100644 --- a/pkg/domain/infra/tunnel/containers.go +++ b/pkg/domain/infra/tunnel/containers.go @@ -445,10 +445,15 @@ func startAndAttach(ic *ContainerEngine, name string, detachKeys *string, input, }() // Wait for the attach to actually happen before starting // the container. - <-attachReady - if err := containers.Start(ic.ClientCxt, name, detachKeys); err != nil { + select { + case <-attachReady: + if err := containers.Start(ic.ClientCxt, name, detachKeys); err != nil { + return err + } + case err := <-attachErr: return err } + // If attachReady happens first, wait for containers.Attach to complete return <-attachErr } -- cgit v1.2.3-54-g00ecf