Browse Source

Windows: Fixed escaping of command line arguments

This fixes some tests that were failing on windows

Signed-off-by: Darren Stahl <darst@microsoft.com>
Darren Stahl 9 years ago
parent
commit
ca5cc770b9
2 changed files with 5 additions and 7 deletions
  1. 2 1
      daemon/execdriver/windows/run.go
  2. 3 6
      integration-cli/docker_cli_run_test.go

+ 2 - 1
daemon/execdriver/windows/run.go

@@ -12,6 +12,7 @@ import (
 	"path/filepath"
 	"strconv"
 	"strings"
+	"syscall"
 
 	"github.com/Sirupsen/logrus"
 	"github.com/docker/docker/daemon/execdriver"
@@ -258,7 +259,7 @@ func (d *Driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, hooks execd
 	createProcessParms.CommandLine = c.ProcessConfig.Entrypoint
 	for _, arg := range c.ProcessConfig.Arguments {
 		logrus.Debugln("appending ", arg)
-		createProcessParms.CommandLine += " " + arg
+		createProcessParms.CommandLine += " " + syscall.EscapeArg(arg)
 	}
 	logrus.Debugf("CommandLine: %s", createProcessParms.CommandLine)
 

+ 3 - 6
integration-cli/docker_cli_run_test.go

@@ -450,12 +450,9 @@ func (s *DockerSuite) TestRunExitCode(c *check.C) {
 		exit int
 		err  error
 	)
-	if daemonPlatform == "windows" {
-		// FIXME Windows: Work out the bug in busybox why exit doesn't set the exit code.
-		_, exit, err = dockerCmdWithError("run", WindowsBaseImage, "cmd", "/s", "/c", "exit 72")
-	} else {
-		_, exit, err = dockerCmdWithError("run", "busybox", "/bin/sh", "-c", "exit 72")
-	}
+
+	_, exit, err = dockerCmdWithError("run", "busybox", "/bin/sh", "-c", "exit 72")
+
 	if err == nil {
 		c.Fatal("should not have a non nil error")
 	}