func main() { exer, err := raru.NewExecutor() if err != nil { log.Printf("raru critical failure: %s", err.Error()) os.Exit(1) } if err := exer.Exec(os.Args[0], os.Args[1:]...); err != nil { log.Printf("raru critical failure: %s", err.Error()) os.Exit(1) } }
func main() { if len(os.Args) == 1 { usageQuit() } exer, err := raru.NewExecutor() if err != nil { log.Printf("raru critical failure: %s", err.Error()) os.Exit(1) } if err := exer.Exec(os.Args[1], os.Args[2:]...); err != nil { log.Printf("raru critical failure: %s", err.Error()) os.Exit(1) } }
func main() { if len(os.Args) == 1 { usageQuit() } exer, err := raru.NewExecutor() if err != nil { log.Printf("raru critical failure: %s", err.Error()) os.Exit(1) } cmd := exec.Command(os.Args[1], os.Args[2:]...) cmd.Stdin = os.Stdin cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr if err := exer.Spawn(cmd); err != nil { log.Printf("raru critical failure: %s", err.Error()) os.Exit(1) } }
func run(c *cli.Context) { name := c.Args().First() tail := c.Args().Tail() if name == "" { if name = os.Getenv("SHELL"); name == "" { name = "sh" } tail = []string{"-i"} } exer, err := raru.NewExecutor() if err != nil { log.Printf("raru critical failure: %s", err.Error()) os.Exit(1) } if c.IsSet("chroot") { exer.SetChrootDir(c.String("chroot")) } if c.Bool("fork") { cmd := exec.Command(name, tail...) cmd.Stdin = os.Stdin cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr if err := exer.Spawn(cmd); err != nil { log.Printf("raru critical failure: %s", err.Error()) os.Exit(1) } } else { if err := exer.Exec(name, tail...); err != nil { log.Printf("raru critical failure: %s", err.Error()) os.Exit(1) } } }