github.com/smithx10/nomad@v0.9.1-rc1/nsenter_linux.go (about) 1 package main 2 3 import ( 4 "os" 5 "runtime" 6 7 hclog "github.com/hashicorp/go-hclog" 8 "github.com/opencontainers/runc/libcontainer" 9 _ "github.com/opencontainers/runc/libcontainer/nsenter" 10 ) 11 12 // init is only run on linux and is used when the LibcontainerExecutor starts 13 // a new process. The libcontainer shim takes over the process, setting up the 14 // configured isolation and limitions before execve into the user process 15 func init() { 16 if len(os.Args) > 1 && os.Args[1] == "libcontainer-shim" { 17 runtime.GOMAXPROCS(1) 18 runtime.LockOSThread() 19 factory, _ := libcontainer.New("") 20 if err := factory.StartInitialization(); err != nil { 21 hclog.L().Error("failed to initialize libcontainer-shim", "error", err) 22 os.Exit(1) 23 } 24 panic("--this line should have never been executed, congratulations--") 25 } 26 }