fork/exec.没有这样的文件或目录退出状态1 [英] fork/exec . no such file or directory exit status 1
本文介绍了fork/exec.没有这样的文件或目录退出状态1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在Mac(darwin/amd64)上使用Go 1.10.2,并且遇到此错误.就是说没有这样的文件或目录.
I am using Go 1.10.2 on Mac (darwin/amd64) and facing this error. It's saying no such file or directory.
这是我的代码,
func loop1(gor_name string, ras_ip string) {
var a string
var c string
a = search_path()
fmt.Printf("当前路径为", a)
fmt.Println(os.Chdir(a))
c = fmt.Sprintf("%s %s %s %s", "./goreplay --input-file ", gor_name, " --input-file-loop --output-http ", ras_ip)
fmt.Printf("c: ", c)
cmd := exec.Command(c)
err := cmd.Run()
if err != nil {
log.Fatal(err)
}
channel <- 1
}
非常感谢您提出任何建议.
Thanks a lot for any suggestions.
推荐答案
exec.Command的函数签名为:
The function signature for exec.Command is:
func Command(name string, args ...string) *Cmd
其中,name
是程序的名称,而args
是参数.试试这个:
where name
is the name of the program and args
are the arguments. Try this:
cmd := exec.Command("./goreplay", "--input-file", gor_name, "--input-file-loop", "--output-http", ras_ip)
这篇关于fork/exec.没有这样的文件或目录退出状态1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文