不需要用到StdoutPipe, 直接将cmd.Stdout设为os.Stdout, gcmd.Stderr = os.Stderr
func main() {
cmd := exec.Command("/bin/sh", "-c", "git clone --progress http://github.com/leanote/leanote /Users/life/Desktop/tmp") cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr err := cmd.Run() if err != nil { fmt.Println("cmd.Output: ", err) return }
}