为什么报错?exit status 64

greatit · 2015-04-21 09:01:57 · 2598 次点击

改成这样

exec.Command("ping", "-c 1", "-W 1", "127.0.0.1")
#1
更多评论

代码:

package main

import (
    "fmt"
    "os/exec"
)

func main() {
    cmd := exec.Command("ping", "-c 1 -W 1", "127.0.0.1")
    out, err := cmd.Output()
    if err != nil {
        fmt.Printf("Command Error", err.Error())
    } else {
        fmt.Printf("%s\n", out)
    }
}
#2