summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-02-14 20:13:20 +0100
committerGitHub <noreply@github.com>2020-02-14 20:13:20 +0100
commit0668483cf04bc7089ed176fb0b6700aebf80aaf9 (patch)
tree5d327a91f842252c668d75cf25a042b1d8b343ab /pkg
parentc2ea27dec0d3a0390fb9b06519e144d6419001e4 (diff)
parentebfd253fc658ffc914260f82b0ff3aac34c02baa (diff)
downloadpodman-0668483cf04bc7089ed176fb0b6700aebf80aaf9.tar.gz
podman-0668483cf04bc7089ed176fb0b6700aebf80aaf9.tar.bz2
podman-0668483cf04bc7089ed176fb0b6700aebf80aaf9.zip
Merge pull request #5203 from QiWang19/disable-detach-key
fix bug "" disable detach keys
Diffstat (limited to 'pkg')
-rw-r--r--pkg/adapter/containers.go36
1 files changed, 24 insertions, 12 deletions
diff --git a/pkg/adapter/containers.go b/pkg/adapter/containers.go
index f66999ffa..cada93829 100644
--- a/pkg/adapter/containers.go
+++ b/pkg/adapter/containers.go
@@ -444,9 +444,12 @@ func (r *LocalRuntime) Run(ctx context.Context, c *cliconfig.RunValues, exitCode
}
}
- keys, err := r.selectDetachKeys(c.String("detach-keys"))
- if err != nil {
- return exitCode, err
+ keys := c.String("detach-keys")
+ if !c.IsSet("detach-keys") {
+ keys, err = r.selectDetachKeys(keys)
+ if err != nil {
+ return exitCode, err
+ }
}
// if the container was created as part of a pod, also start its dependencies, if any.
@@ -534,9 +537,12 @@ func (r *LocalRuntime) Attach(ctx context.Context, c *cliconfig.AttachValues) er
inputStream = nil
}
- keys, err := r.selectDetachKeys(c.DetachKeys)
- if err != nil {
- return err
+ keys := c.DetachKeys
+ if !c.IsSet("detach-keys") {
+ keys, err = r.selectDetachKeys(keys)
+ if err != nil {
+ return err
+ }
}
// If the container is in a pod, also set to recursively start dependencies
@@ -674,9 +680,12 @@ func (r *LocalRuntime) Start(ctx context.Context, c *cliconfig.StartValues, sigP
}
}
- keys, err := r.selectDetachKeys(c.DetachKeys)
- if err != nil {
- return exitCode, err
+ keys := c.DetachKeys
+ if !c.IsSet("detach-keys") {
+ keys, err = r.selectDetachKeys(keys)
+ if err != nil {
+ return exitCode, err
+ }
}
// attach to the container and also start it not already running
@@ -975,9 +984,12 @@ func (r *LocalRuntime) ExecContainer(ctx context.Context, cli *cliconfig.ExecVal
streams.AttachOutput = true
streams.AttachError = true
- keys, err := r.selectDetachKeys(cli.DetachKeys)
- if err != nil {
- return ec, err
+ keys := cli.DetachKeys
+ if !cli.IsSet("detach-keys") {
+ keys, err = r.selectDetachKeys(keys)
+ if err != nil {
+ return ec, err
+ }
}
ec, err = ExecAttachCtr(ctx, ctr.Container, cli.Tty, cli.Privileged, env, cmd, cli.User, cli.Workdir, streams, uint(cli.PreserveFDs), keys)