mirror of
				https://github.com/moby/moby.git
				synced 2022-11-09 12:21:53 -05:00 
			
		
		
		
	Merge pull request #33815 from jstarks/lcow_command_args
LCOW: pass command arguments without extra quoting
This commit is contained in:
		
						commit
						bcc8b2bc47
					
				
					 4 changed files with 15 additions and 5 deletions
				
			
		| 
						 | 
				
			
			@ -8,7 +8,9 @@ import (
 | 
			
		|||
 | 
			
		||||
func execSetPlatformOpt(c *container.Container, ec *exec.Config, p *libcontainerd.Process) error {
 | 
			
		||||
	// Process arguments need to be escaped before sending to OCI.
 | 
			
		||||
	p.Args = escapeArgs(p.Args)
 | 
			
		||||
	p.User.Username = ec.User
 | 
			
		||||
	if c.Platform == "windows" {
 | 
			
		||||
		p.Args = escapeArgs(p.Args)
 | 
			
		||||
		p.User.Username = ec.User
 | 
			
		||||
	}
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -98,7 +98,7 @@ func (daemon *Daemon) createSpec(c *container.Container) (*specs.Spec, error) {
 | 
			
		|||
 | 
			
		||||
	// In s.Process
 | 
			
		||||
	s.Process.Args = append([]string{c.Path}, c.Args...)
 | 
			
		||||
	if !c.Config.ArgsEscaped {
 | 
			
		||||
	if !c.Config.ArgsEscaped && img.OS == "windows" {
 | 
			
		||||
		s.Process.Args = escapeArgs(s.Process.Args)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -420,7 +420,11 @@ func (clnt *client) AddProcess(ctx context.Context, containerID, processFriendly
 | 
			
		|||
 | 
			
		||||
	// Configure the environment for the process
 | 
			
		||||
	createProcessParms.Environment = setupEnvironmentVariables(procToAdd.Env)
 | 
			
		||||
	createProcessParms.CommandLine = strings.Join(procToAdd.Args, " ")
 | 
			
		||||
	if container.ociSpec.Platform.OS == "windows" {
 | 
			
		||||
		createProcessParms.CommandLine = strings.Join(procToAdd.Args, " ")
 | 
			
		||||
	} else {
 | 
			
		||||
		createProcessParms.CommandArgs = procToAdd.Args
 | 
			
		||||
	}
 | 
			
		||||
	createProcessParms.User = procToAdd.User.Username
 | 
			
		||||
 | 
			
		||||
	logrus.Debugf("libcontainerd: commandLine: %s", createProcessParms.CommandLine)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -82,7 +82,11 @@ func (ctr *container) start(attachStdio StdioCallback) error {
 | 
			
		|||
 | 
			
		||||
	// Configure the environment for the process
 | 
			
		||||
	createProcessParms.Environment = setupEnvironmentVariables(ctr.ociSpec.Process.Env)
 | 
			
		||||
	createProcessParms.CommandLine = strings.Join(ctr.ociSpec.Process.Args, " ")
 | 
			
		||||
	if ctr.ociSpec.Platform.OS == "windows" {
 | 
			
		||||
		createProcessParms.CommandLine = strings.Join(ctr.ociSpec.Process.Args, " ")
 | 
			
		||||
	} else {
 | 
			
		||||
		createProcessParms.CommandArgs = ctr.ociSpec.Process.Args
 | 
			
		||||
	}
 | 
			
		||||
	createProcessParms.User = ctr.ociSpec.Process.User.Username
 | 
			
		||||
 | 
			
		||||
	// LCOW requires the raw OCI spec passed through HCS and onwards to GCS for the utility VM.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue