summaryrefslogtreecommitdiff
path: root/pkg/domain/infra/tunnel/containers.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-06-15 14:11:00 -0400
committerGitHub <noreply@github.com>2020-06-15 14:11:00 -0400
commit2c7b39ddb8961bf547a36420407adb461dd4c227 (patch)
tree77033bb5fcf8b35360b864f18a8614a04bf831e4 /pkg/domain/infra/tunnel/containers.go
parent8a42a32c71431194cd6945bf2b88c8a278803280 (diff)
parentb2792dd76a7b62fcea072d91faf09d1bc8c18b61 (diff)
downloadpodman-2c7b39ddb8961bf547a36420407adb461dd4c227.tar.gz
podman-2c7b39ddb8961bf547a36420407adb461dd4c227.tar.bz2
podman-2c7b39ddb8961bf547a36420407adb461dd4c227.zip
Merge pull request #6589 from rhatdan/attach
Handle errors on attach properly
Diffstat (limited to 'pkg/domain/infra/tunnel/containers.go')
-rw-r--r--pkg/domain/infra/tunnel/containers.go9
1 files changed, 7 insertions, 2 deletions
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
}