diff options
author | Marco Vedovati <mvedovati@suse.com> | 2019-06-13 19:33:58 +0200 |
---|---|---|
committer | Marco Vedovati <mvedovati@suse.com> | 2019-06-26 10:12:34 +0200 |
commit | 7e3f1c21b060762c39139d59f73ad589a54e03fa (patch) | |
tree | 7f5277de21ca56187c1a794cc79ad0c643aaca4e /pkg/adapter/containers.go | |
parent | c9078936dd1bf5bdb59066eb1bdd179ac58f98e1 (diff) | |
download | podman-7e3f1c21b060762c39139d59f73ad589a54e03fa.tar.gz podman-7e3f1c21b060762c39139d59f73ad589a54e03fa.tar.bz2 podman-7e3f1c21b060762c39139d59f73ad589a54e03fa.zip |
libpod: specify a detach keys sequence in libpod.conf
Add the ability of specifying a detach keys sequence in libpod.conf
Signed-off-by: Marco Vedovati <mvedovati@suse.com>
Diffstat (limited to 'pkg/adapter/containers.go')
-rw-r--r-- | pkg/adapter/containers.go | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/pkg/adapter/containers.go b/pkg/adapter/containers.go index 5751a9c3a..38c04cceb 100644 --- a/pkg/adapter/containers.go +++ b/pkg/adapter/containers.go @@ -381,8 +381,18 @@ func (r *LocalRuntime) Run(ctx context.Context, c *cliconfig.RunValues, exitCode } } } + + config, err := r.Runtime.GetConfig() + if err != nil { + return exitCode, err + } + detachKeys := c.String("detach-keys") + if detachKeys == "" { + detachKeys = config.DetachKeys + } + // if the container was created as part of a pod, also start its dependencies, if any. - if err := StartAttachCtr(ctx, ctr, outputStream, errorStream, inputStream, c.String("detach-keys"), c.Bool("sig-proxy"), true, c.IsSet("pod")); err != nil { + if err := StartAttachCtr(ctx, ctr, outputStream, errorStream, inputStream, detachKeys, c.Bool("sig-proxy"), true, c.IsSet("pod")); err != nil { // We've manually detached from the container // Do not perform cleanup, or wait for container exit code // Just exit immediately @@ -407,10 +417,6 @@ func (r *LocalRuntime) Run(ctx context.Context, c *cliconfig.RunValues, exitCode if errors.Cause(err) == define.ErrNoSuchCtr { // The container may have been removed // Go looking for an exit file - config, err := r.Runtime.GetConfig() - if err != nil { - return exitCode, err - } ctrExitCode, err := ReadExitFile(config.TmpDir, ctr.ID()) if err != nil { logrus.Errorf("Cannot get exit code: %v", err) |