|
|
|
@ -165,7 +165,7 @@ func EntryPoint(command []string) error {
|
|
|
|
|
return syscall.Exec(path, command, os.Environ())
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func Run(detach bool, mounts []string, command []string) error {
|
|
|
|
|
func Run(privileged bool, detach bool, mounts []string, command []string) error {
|
|
|
|
|
workDir, err := os.Getwd()
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
@ -249,6 +249,10 @@ func Run(detach bool, mounts []string, command []string) error {
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if privileged {
|
|
|
|
|
dockerCommand = append(dockerCommand, "--privileged")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if detach {
|
|
|
|
|
dockerCommand = append(dockerCommand, "--detach")
|
|
|
|
|
}
|
|
|
|
@ -398,6 +402,14 @@ func main() {
|
|
|
|
|
"Whether or not to detach from the container after running the command",
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
var privileged bool
|
|
|
|
|
run.BoolVar(
|
|
|
|
|
&privileged,
|
|
|
|
|
"privileged",
|
|
|
|
|
false,
|
|
|
|
|
"Whether or not to detach from the container after running the command",
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
var mounts arrayFlag
|
|
|
|
|
run.Var(&mounts, "mount", "Directory to mount inside the workspace container")
|
|
|
|
|
|
|
|
|
@ -416,7 +428,7 @@ func main() {
|
|
|
|
|
os.Exit(1)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
err = Run(detach, mounts, run.Args())
|
|
|
|
|
err = Run(privileged, detach, mounts, run.Args())
|
|
|
|
|
if err != nil {
|
|
|
|
|
fmt.Println("error running command in container", err)
|
|
|
|
|
os.Exit(1)
|
|
|
|
|