From 6fa0239772e672eefb98cef91ca8d806b86182b0 Mon Sep 17 00:00:00 2001 From: John Starks Date: Mon, 28 Mar 2016 17:35:56 -0700 Subject: [PATCH] Windows: escape entrypoint before passing to libcontainerd This makes Windows behavior consistent with Linux -- the entry point must be an executable, not an executable and set of arguments. Signed-off-by: John Starks --- daemon/exec_windows.go | 3 +-- daemon/oci_windows.go | 8 +++----- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/daemon/exec_windows.go b/daemon/exec_windows.go index be25d20007..a6ac1db42d 100644 --- a/daemon/exec_windows.go +++ b/daemon/exec_windows.go @@ -8,7 +8,6 @@ import ( func execSetPlatformOpt(c *container.Container, ec *exec.Config, p *libcontainerd.Process) error { // Process arguments need to be escaped before sending to OCI. - // TODO (jstarks): escape the entrypoint too once the tests are fixed to not rely on this behavior - p.Args = append([]string{p.Args[0]}, escapeArgs(p.Args[1:])...) + p.Args = escapeArgs(p.Args) return nil } diff --git a/daemon/oci_windows.go b/daemon/oci_windows.go index 5bf3f82418..06eb7f5b4d 100644 --- a/daemon/oci_windows.go +++ b/daemon/oci_windows.go @@ -63,11 +63,9 @@ func (daemon *Daemon) createSpec(c *container.Container) (*libcontainerd.Spec, e } // In s.Process - if c.Config.ArgsEscaped { - s.Process.Args = append([]string{c.Path}, c.Args...) - } else { - // TODO (jstarks): escape the entrypoint too once the tests are fixed to not rely on this behavior - s.Process.Args = append([]string{c.Path}, escapeArgs(c.Args)...) + s.Process.Args = append([]string{c.Path}, c.Args...) + if !c.Config.ArgsEscaped { + s.Process.Args = escapeArgs(s.Process.Args) } s.Process.Cwd = c.Config.WorkingDir s.Process.Env = c.CreateDaemonEnvironment(linkedEnv)