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 <dcanter@microsoft.com>
This commit is contained in:
Daniel Canter 2021-09-02 03:59:56 -07:00
parent e00f87f1dc
commit 27046a9e06

View File

@ -104,6 +104,10 @@ var execCommand = cli.Command{
pspec.Terminal = tty pspec.Terminal = tty
pspec.Args = args pspec.Args = args
if cwd := context.String("cwd"); cwd != "" {
pspec.Cwd = cwd
}
task, err := container.Task(ctx, nil) task, err := container.Task(ctx, nil)
if err != nil { if err != nil {
return err return err