summaryrefslogtreecommitdiff
path: root/libpod/container_api.go
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2018-06-22 05:32:45 -0400
committerGitHub <noreply@github.com>2018-06-22 05:32:45 -0400
commit4ad7e7368140f4677f8919f647cd5d6951d7e60e (patch)
tree3fd80de296f177c9cce8ec611a6dcf7c5022033a /libpod/container_api.go
parent4bd0f229e453ea8976978a422a011cc774870346 (diff)
parentda44d8d5c839c7e09714495a7b121d8aa8664413 (diff)
downloadpodman-4ad7e7368140f4677f8919f647cd5d6951d7e60e.tar.gz
podman-4ad7e7368140f4677f8919f647cd5d6951d7e60e.tar.bz2
podman-4ad7e7368140f4677f8919f647cd5d6951d7e60e.zip
Merge pull request #970 from giuseppe/fix-start-attach
libpod: fix race with attach/start
Diffstat (limited to 'libpod/container_api.go')
-rw-r--r--libpod/container_api.go10
1 files changed, 2 insertions, 8 deletions
diff --git a/libpod/container_api.go b/libpod/container_api.go
index 0ddccfe8e..96648ccf5 100644
--- a/libpod/container_api.go
+++ b/libpod/container_api.go
@@ -178,18 +178,12 @@ func (c *Container) StartAndAttach(ctx context.Context, streams *AttachStreams,
// Attach to the container before starting it
go func() {
- if err := c.attach(streams, keys, resize); err != nil {
+ if err := c.attach(streams, keys, resize, true); err != nil {
attachChan <- err
}
close(attachChan)
}()
- // Start the container
- if err := c.start(); err != nil {
- // TODO: interrupt the attach here if we error
- return nil, err
- }
-
return attachChan, nil
}
@@ -421,7 +415,7 @@ func (c *Container) Attach(streams *AttachStreams, keys string, resize <-chan re
return errors.Wrapf(ErrCtrStateInvalid, "can only attach to created or running containers")
}
- return c.attach(streams, keys, resize)
+ return c.attach(streams, keys, resize, false)
}
// Mount mounts a container's filesystem on the host