func exeCmd() {
cmd := exec.Command("ls","-l","/usr")
fmt.Println(cmd)
fmt.Println("Cmd", cmd.Args)
var out bytes.Buffer
cmd.Stdout = &out
cmd.Stderr = os.Stderr
err := cmd.Start()
if err != nil {
panic(err)
}
err = cmd.Wait()
fmt.Println(out.String())
}
网友评论