提交 d0f0a872 编写于 作者: A aarzilli 提交者: Derek Parker

Documentation,Makefile: better error when gencert.sh fails

Fixes #1378
上级 ff760d87
......@@ -21,6 +21,6 @@ Only do this if you have a valid reason to use the native backend.
1. Run `xcode-select --install`
2. On macOS 10.14 manually install the legacy include headers by running `/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg`
3. Clone the repo into `$GOPATH/src/github.com/derekparker/delve`
4. Run `make install` in that directory
4. Run `make install` in that directory (on some versions of macOS this requires being root, the first time you run it, to install a new certificate)
The makefile will take care of creating and installing a self-signed certificate automatically.
......@@ -105,22 +105,33 @@ This option can only be specified if testset is basic or a single package.`)
return RootCommand
}
func checkCertCmd(cmd *cobra.Command, args []string) {
func checkCert() bool {
// If we're on OSX make sure the proper CERT env var is set.
if os.Getenv("TRAVIS") == "true" || runtime.GOOS != "darwin" || os.Getenv("CERT") != "" {
return
return true
}
x := exec.Command("scripts/gencert.sh")
x.Stdout = os.Stdout
x.Stderr = os.Stderr
x.Env = os.Environ()
err := x.Run()
if x.ProcessState != nil && !x.ProcessState.Success() {
fmt.Printf("An error occurred when generating and installing a new certificate\n")
os.Exit(1)
return false
}
if err != nil {
log.Fatal(err)
fmt.Printf("An error occoured when generating and installing a new certificate: %v\n", err)
return false
}
os.Setenv("CERT", "dlv-cert")
return true
}
func checkCertCmd(cmd *cobra.Command, args []string) {
if !checkCert() {
os.Exit(1)
}
}
func strflatten(v []interface{}) []string {
......@@ -214,7 +225,9 @@ func prepareMacnative() string {
if !canMacnative() {
return ""
}
checkCertCmd(nil, nil)
if !checkCert() {
return ""
}
return "-tags=macnative"
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册