【发布时间】:2019-10-09 22:21:36
【问题描述】:
在我的 shell 中,我可以执行命令 acme.sh --issue --dns -d exmaple.com --yes-I-know-dns-manual-mode-enough-go-ahead-please 并获得输出。
现在我想在 go 中执行此操作,我的代码如下:
cmd := exec.Command("bash", "-c", "acme.sh --issue --dns -d exmaple.com --yes-I-know-dns-manual-mode-enough-go-ahead-please");
out, err := cmd.CombinedOutput()
if err != nil {
log.Fatalf("issue failed with error: %s\n", err)
}
fmt.Printf("combined out:\n%s\n", string(out))
但我收到错误exit status 1。
正如评论所说,我分开了论点:
exec.Command("bash", "-c", "acme.sh", "--issue", "--dns", "-d exmaple.com", "--yes-I-know-dns-manual-mode-enough-go-ahead-please");
但结果是它在没有参数的情况下执行acme.sh。
【问题讨论】:
-
你的英语很好。感谢您更新问题。