Browse code

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 <jostarks@microsoft.com>

John Starks authored on 2016/03/29 09:35:56
Showing 2 changed files
... ...
@@ -8,7 +8,6 @@ import (
8 8
 
9 9
 func execSetPlatformOpt(c *container.Container, ec *exec.Config, p *libcontainerd.Process) error {
10 10
 	// Process arguments need to be escaped before sending to OCI.
11
-	// TODO (jstarks): escape the entrypoint too once the tests are fixed to not rely on this behavior
12
-	p.Args = append([]string{p.Args[0]}, escapeArgs(p.Args[1:])...)
11
+	p.Args = escapeArgs(p.Args)
13 12
 	return nil
14 13
 }
... ...
@@ -63,11 +63,9 @@ func (daemon *Daemon) createSpec(c *container.Container) (*libcontainerd.Spec, e
63 63
 	}
64 64
 
65 65
 	// In s.Process
66
-	if c.Config.ArgsEscaped {
67
-		s.Process.Args = append([]string{c.Path}, c.Args...)
68
-	} else {
69
-		// TODO (jstarks): escape the entrypoint too once the tests are fixed to not rely on this behavior
70
-		s.Process.Args = append([]string{c.Path}, escapeArgs(c.Args)...)
66
+	s.Process.Args = append([]string{c.Path}, c.Args...)
67
+	if !c.Config.ArgsEscaped {
68
+		s.Process.Args = escapeArgs(s.Process.Args)
71 69
 	}
72 70
 	s.Process.Cwd = c.Config.WorkingDir
73 71
 	s.Process.Env = c.CreateDaemonEnvironment(linkedEnv)