binfmt_misc: fix building on windows

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
docker-19.03
Tonis Tiigi 2019-04-03 00:23:44 -07:00
parent 62e5542790
commit a61d7a40a2
3 changed files with 25 additions and 4 deletions

View File

@ -8,7 +8,6 @@ import (
"os" "os"
"os/exec" "os/exec"
"path/filepath" "path/filepath"
"syscall"
) )
func check(bin string) error { func check(bin string) error {
@ -37,9 +36,7 @@ func check(bin string) error {
f.Close() f.Close()
cmd := exec.Command("/check") cmd := exec.Command("/check")
cmd.SysProcAttr = &syscall.SysProcAttr{ withChroot(cmd, tmpdir)
Chroot: tmpdir,
}
err = cmd.Run() err = cmd.Run()
return err return err
} }

View File

@ -0,0 +1,14 @@
// +build !windows
package binfmt_misc
import (
"os/exec"
"syscall"
)
func withChroot(cmd *exec.Cmd, dir string) {
cmd.SysProcAttr = &syscall.SysProcAttr{
Chroot: dir,
}
}

View File

@ -0,0 +1,10 @@
// +build windows
package binfmt_misc
import (
"os/exec"
)
func withChroot(cmd *exec.Cmd, dir string) {
}