summaryrefslogtreecommitdiff
path: root/pkg/domain/infra/tunnel
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2020-06-12 07:49:28 -0400
committerDaniel J Walsh <dwalsh@redhat.com>2020-06-15 12:37:17 -0400
commitb2792dd76a7b62fcea072d91faf09d1bc8c18b61 (patch)
treed18cea3a4369e450f9c0e3aad23a3e5cabe70c4e /pkg/domain/infra/tunnel
parentb89729778c253f0eccd2dd762e5d0a6547aaea7d (diff)
downloadpodman-b2792dd76a7b62fcea072d91faf09d1bc8c18b61.tar.gz
podman-b2792dd76a7b62fcea072d91faf09d1bc8c18b61.tar.bz2
podman-b2792dd76a7b62fcea072d91faf09d1bc8c18b61.zip
Handle errors on attach properly
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'pkg/domain/infra/tunnel')
-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
}