summaryrefslogtreecommitdiff
path: root/libpod/oci.go
diff options
context:
space:
mode:
authorDebarshi Ray <rishi@fedoraproject.org>2019-01-08 12:53:50 +0100
committerDebarshi Ray <rishi@fedoraproject.org>2019-01-08 17:42:37 +0100
commit867669374c3fdd39f2629e53cbe7430f1bc3e085 (patch)
treeff744348a1f94cac55771eeb6e36d7ae47579ec7 /libpod/oci.go
parent9474b8cea239348d11c913b03b9461afaf663f0b (diff)
downloadpodman-867669374c3fdd39f2629e53cbe7430f1bc3e085.tar.gz
podman-867669374c3fdd39f2629e53cbe7430f1bc3e085.tar.bz2
podman-867669374c3fdd39f2629e53cbe7430f1bc3e085.zip
Add a --workdir option to 'podman exec'
Signed-off-by: Debarshi Ray <rishi@fedoraproject.org>
Diffstat (limited to 'libpod/oci.go')
-rw-r--r--libpod/oci.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/libpod/oci.go b/libpod/oci.go
index 093bfdd35..31c1a7e85 100644
--- a/libpod/oci.go
+++ b/libpod/oci.go
@@ -728,7 +728,7 @@ func (r *OCIRuntime) unpauseContainer(ctr *Container) error {
// TODO: Add --detach support
// TODO: Convert to use conmon
// TODO: add --pid-file and use that to generate exec session tracking
-func (r *OCIRuntime) execContainer(c *Container, cmd, capAdd, env []string, tty bool, user, sessionID string) (*exec.Cmd, error) {
+func (r *OCIRuntime) execContainer(c *Container, cmd, capAdd, env []string, tty bool, cwd, user, sessionID string) (*exec.Cmd, error) {
if len(cmd) == 0 {
return nil, errors.Wrapf(ErrInvalidArg, "must provide a command to execute")
}
@@ -749,7 +749,9 @@ func (r *OCIRuntime) execContainer(c *Container, cmd, capAdd, env []string, tty
args = append(args, "exec")
- args = append(args, "--cwd", c.config.Spec.Process.Cwd)
+ if cwd != "" {
+ args = append(args, "--cwd", cwd)
+ }
args = append(args, "--pid-file", c.execPidPath(sessionID))