github.com/hustcat/docker@v1.3.3-0.20160314103604-901c67a8eeab/daemon/execdriver/windows/commandlinebuilder.go (about) 1 //+build windows 2 3 package windows 4 5 import ( 6 "errors" 7 "syscall" 8 9 "github.com/Sirupsen/logrus" 10 "github.com/docker/docker/daemon/execdriver" 11 ) 12 13 // createCommandLine creates a command line from the Entrypoint and args 14 // of the ProcessConfig. It escapes the arguments if they are not already 15 // escaped 16 func createCommandLine(processConfig *execdriver.ProcessConfig, alreadyEscaped bool) (commandLine string, err error) { 17 // While this should get caught earlier, just in case, validate that we 18 // have something to run. 19 if processConfig.Entrypoint == "" { 20 return "", errors.New("No entrypoint specified") 21 } 22 23 // Build the command line of the process 24 commandLine = processConfig.Entrypoint 25 logrus.Debugf("Entrypoint: %s", processConfig.Entrypoint) 26 for _, arg := range processConfig.Arguments { 27 logrus.Debugf("appending %s", arg) 28 if !alreadyEscaped { 29 arg = syscall.EscapeArg(arg) 30 } 31 commandLine += " " + arg 32 } 33 34 logrus.Debugf("commandLine: %s", commandLine) 35 return commandLine, nil 36 }