Skip to content

Commit 27046a9

Browse files
committed
Fix cwd flag for ctr tasks exec
It seems like the cwd flag isn't used anywhere for ctr tasks exec. This change just sets the cwd field on the spec for the execed process if a new one was asked for, otherwise it will continue using whatever was on the containers spec. Signed-off-by: Daniel Canter <[email protected]>
1 parent e00f87f commit 27046a9

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

cmd/ctr/commands/tasks/exec.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ var execCommand = cli.Command{
104104
pspec.Terminal = tty
105105
pspec.Args = args
106106

107+
if cwd := context.String("cwd"); cwd != "" {
108+
pspec.Cwd = cwd
109+
}
110+
107111
task, err := container.Task(ctx, nil)
108112
if err != nil {
109113
return err

0 commit comments

Comments
 (0)