This fixes the case where arguments are escaped twice from Dockerfiles on
Windows Signed-off-by: Darren Stahl <darst@microsoft.com> Upstream-commit: 9db5db1b94bc1000d151315851096dcc6cd3512d Component: engine
This commit is contained in:
@@ -389,6 +389,8 @@ func run(b *Builder, args []string, attributes map[string]bool, original string)
|
||||
b.runConfig.Cmd = config.Cmd
|
||||
// set build-time environment for 'run'.
|
||||
b.runConfig.Env = append(b.runConfig.Env, cmdBuildEnv...)
|
||||
// set config as already being escaped, this prevents double escaping on windows
|
||||
b.runConfig.ArgsEscaped = true
|
||||
|
||||
logrus.Debugf("[BUILDER] Command to be executed: %v", b.runConfig.Cmd)
|
||||
|
||||
@@ -479,7 +481,7 @@ func entrypoint(b *Builder, args []string, attributes map[string]bool, original
|
||||
if runtime.GOOS != "windows" {
|
||||
b.runConfig.Entrypoint = stringutils.NewStrSlice("/bin/sh", "-c", parsed[0])
|
||||
} else {
|
||||
b.runConfig.Entrypoint = stringutils.NewStrSlice("cmd", "/S /C", parsed[0])
|
||||
b.runConfig.Entrypoint = stringutils.NewStrSlice("cmd", "/S", "/C", parsed[0])
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -181,7 +181,7 @@ func (b *Builder) runContextCommand(args []string, allowRemote bool, allowLocalD
|
||||
if runtime.GOOS != "windows" {
|
||||
b.runConfig.Cmd = stringutils.NewStrSlice("/bin/sh", "-c", fmt.Sprintf("#(nop) %s %s in %s", cmdName, srcHash, dest))
|
||||
} else {
|
||||
b.runConfig.Cmd = stringutils.NewStrSlice("cmd", "/S /C", fmt.Sprintf("REM (nop) %s %s in %s", cmdName, srcHash, dest))
|
||||
b.runConfig.Cmd = stringutils.NewStrSlice("cmd", "/S", "/C", fmt.Sprintf("REM (nop) %s %s in %s", cmdName, srcHash, dest))
|
||||
}
|
||||
defer func(cmd *stringutils.StrSlice) { b.runConfig.Cmd = cmd }(cmd)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user