summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-03-19 22:09:40 +0100
committerGitHub <noreply@github.com>2020-03-19 22:09:40 +0100
commitaa6c8c2e55a7de14fb22f89af14d5c0636eecee0 (patch)
tree20bb10c738de05c0e323c9ac737d8a7bd5c184f2 /pkg
parentc1ff17acfa647c62fcb8ca6b8f3d15ff45100fb0 (diff)
parente89c6382ae26b6d611106360fdba4f3f304e5616 (diff)
downloadpodman-aa6c8c2e55a7de14fb22f89af14d5c0636eecee0.tar.gz
podman-aa6c8c2e55a7de14fb22f89af14d5c0636eecee0.tar.bz2
podman-aa6c8c2e55a7de14fb22f89af14d5c0636eecee0.zip
Merge pull request #5088 from mheon/begin_exec_rework
Begin exec rework
Diffstat (limited to 'pkg')
-rw-r--r--pkg/adapter/terminal_linux.go14
-rw-r--r--pkg/varlinkapi/containers.go16
2 files changed, 22 insertions, 8 deletions
diff --git a/pkg/adapter/terminal_linux.go b/pkg/adapter/terminal_linux.go
index 3dc5864e2..ef5a6f926 100644
--- a/pkg/adapter/terminal_linux.go
+++ b/pkg/adapter/terminal_linux.go
@@ -16,7 +16,6 @@ import (
// ExecAttachCtr execs and attaches to a container
func ExecAttachCtr(ctx context.Context, ctr *libpod.Container, tty, privileged bool, env map[string]string, cmd []string, user, workDir string, streams *libpod.AttachStreams, preserveFDs uint, detachKeys string) (int, error) {
resize := make(chan remotecommand.TerminalSize)
-
haveTerminal := terminal.IsTerminal(int(os.Stdin.Fd()))
// Check if we are attached to a terminal. If we are, generate resize
@@ -33,7 +32,18 @@ func ExecAttachCtr(ctx context.Context, ctr *libpod.Container, tty, privileged b
}
}()
}
- return ctr.Exec(tty, privileged, env, cmd, user, workDir, streams, preserveFDs, resize, detachKeys)
+
+ execConfig := new(libpod.ExecConfig)
+ execConfig.Command = cmd
+ execConfig.Terminal = tty
+ execConfig.Privileged = privileged
+ execConfig.Environment = env
+ execConfig.User = user
+ execConfig.WorkDir = workDir
+ execConfig.DetachKeys = &detachKeys
+ execConfig.PreserveFDs = preserveFDs
+
+ return ctr.Exec(execConfig, streams, resize)
}
// StartAttachCtr starts and (if required) attaches to a container
diff --git a/pkg/varlinkapi/containers.go b/pkg/varlinkapi/containers.go
index 94726bbbd..55427771c 100644
--- a/pkg/varlinkapi/containers.go
+++ b/pkg/varlinkapi/containers.go
@@ -846,11 +846,6 @@ func (i *LibpodAPI) ExecContainer(call iopodman.VarlinkCall, opts iopodman.ExecO
workDir = *opts.Workdir
}
- var detachKeys string
- if opts.DetachKeys != nil {
- detachKeys = *opts.DetachKeys
- }
-
resizeChan := make(chan remotecommand.TerminalSize)
reader, writer, _, pipeWriter, streams := setupStreams(call)
@@ -870,8 +865,17 @@ func (i *LibpodAPI) ExecContainer(call iopodman.VarlinkCall, opts iopodman.ExecO
}
}()
+ execConfig := new(libpod.ExecConfig)
+ execConfig.Command = opts.Cmd
+ execConfig.Terminal = opts.Tty
+ execConfig.Privileged = opts.Privileged
+ execConfig.Environment = envs
+ execConfig.User = user
+ execConfig.WorkDir = workDir
+ execConfig.DetachKeys = opts.DetachKeys
+
go func() {
- ec, err := ctr.Exec(opts.Tty, opts.Privileged, envs, opts.Cmd, user, workDir, streams, 0, resizeChan, detachKeys)
+ ec, err := ctr.Exec(execConfig, streams, resizeChan)
if err != nil {
logrus.Errorf(err.Error())
}