diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-05-20 22:41:22 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-20 22:41:22 +0200 |
commit | 46ca450436b592b2ae0fdeb6f05746af124cc514 (patch) | |
tree | 18c149fb26e67cbcdc5218df06597baffa02b563 /pkg/domain | |
parent | 6a75dfa8a85d7b9677f545aba976dbe82404cf3d (diff) | |
parent | ce24e1139c63b35ddc2c6b176e5701de1dc9f8b5 (diff) | |
download | podman-46ca450436b592b2ae0fdeb6f05746af124cc514.tar.gz podman-46ca450436b592b2ae0fdeb6f05746af124cc514.tar.bz2 podman-46ca450436b592b2ae0fdeb6f05746af124cc514.zip |
Merge pull request #6300 from baude/v2governattach
govern remote attach and start
Diffstat (limited to 'pkg/domain')
-rw-r--r-- | pkg/domain/infra/tunnel/containers.go | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/pkg/domain/infra/tunnel/containers.go b/pkg/domain/infra/tunnel/containers.go index cebd332e3..828bfae5b 100644 --- a/pkg/domain/infra/tunnel/containers.go +++ b/pkg/domain/infra/tunnel/containers.go @@ -326,7 +326,7 @@ func (ic *ContainerEngine) ContainerLogs(ctx context.Context, containers []strin } func (ic *ContainerEngine) ContainerAttach(ctx context.Context, nameOrId string, options entities.AttachOptions) error { - return containers.Attach(ic.ClientCxt, nameOrId, &options.DetachKeys, nil, bindings.PTrue, options.Stdin, options.Stdout, options.Stderr) + return containers.Attach(ic.ClientCxt, nameOrId, &options.DetachKeys, nil, bindings.PTrue, options.Stdin, options.Stdout, options.Stderr, nil) } func (ic *ContainerEngine) ContainerExec(ctx context.Context, nameOrId string, options entities.ExecOptions) (int, error) { @@ -335,11 +335,14 @@ func (ic *ContainerEngine) ContainerExec(ctx context.Context, nameOrId string, o func startAndAttach(ic *ContainerEngine, name string, detachKeys *string, input, output, errput *os.File) error { //nolint attachErr := make(chan error) + attachReady := make(chan bool) go func() { - err := containers.Attach(ic.ClientCxt, name, detachKeys, bindings.PFalse, bindings.PTrue, input, output, errput) + err := containers.Attach(ic.ClientCxt, name, detachKeys, bindings.PFalse, bindings.PTrue, input, output, errput, attachReady) attachErr <- err }() - + // Wait for the attach to actually happen before starting + // the container. + <-attachReady if err := containers.Start(ic.ClientCxt, name, detachKeys); err != nil { return err } |