github.com/geofffranks/garden-linux@v0.0.0-20160715111146-26c893169cfa/system/test_user_execer/test_user_execer.go (about) 1 package main 2 3 import ( 4 "flag" 5 "fmt" 6 "os" 7 8 "code.cloudfoundry.org/garden-linux/system" 9 ) 10 11 func main() { 12 uid := flag.Int("uid", -1, "uid") 13 gid := flag.Int("gid", -1, "gid") 14 workDir := flag.String("workDir", "", "working directory") 15 flag.Parse() 16 17 execer := system.UserExecer{} 18 if err := execer.ExecAsUser(*uid, *gid, *workDir, "bash", "-c", "id -u && id -G"); err != nil { 19 fmt.Fprintf(os.Stderr, "%s", err) 20 os.Exit(2) 21 } 22 }