github.com/huiliang/nomad@v0.2.1-0.20151124023127-7a8b664699ff/command/spawn_daemon_linux.go (about)

     1  package command
     2  
     3  import "syscall"
     4  
     5  // configureChroot enters the user command into a chroot if specified in the
     6  // config and on an OS that supports Chroots.
     7  func (c *SpawnDaemonCommand) configureChroot() {
     8  	if len(c.config.Chroot) != 0 {
     9  		if c.config.Cmd.SysProcAttr == nil {
    10  			c.config.Cmd.SysProcAttr = &syscall.SysProcAttr{}
    11  		}
    12  
    13  		c.config.Cmd.SysProcAttr.Chroot = c.config.Chroot
    14  		c.config.Cmd.Dir = "/"
    15  	}
    16  }