mirror of
https://github.com/caddyserver/xcaddy.git
synced 2024-11-09 10:50:06 +00:00
Only run compiled binary if same platform (fixes #20)
This commit is contained in:
parent
23d4e0a1ca
commit
823a072ae1
1 changed files with 13 additions and 11 deletions
|
@ -123,17 +123,19 @@ func runBuild(ctx context.Context, args []string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// prove the build is working by printing the version
|
// prove the build is working by printing the version
|
||||||
if !filepath.IsAbs(output) {
|
if runtime.GOOS == os.Getenv("GOOS") && runtime.GOARCH == os.Getenv("GOARCH") {
|
||||||
output = "." + string(filepath.Separator) + output
|
if !filepath.IsAbs(output) {
|
||||||
}
|
output = "." + string(filepath.Separator) + output
|
||||||
fmt.Println()
|
}
|
||||||
fmt.Printf("%s version\n", output)
|
fmt.Println()
|
||||||
cmd := exec.Command(output, "version")
|
fmt.Printf("%s version\n", output)
|
||||||
cmd.Stdout = os.Stdout
|
cmd := exec.Command(output, "version")
|
||||||
cmd.Stderr = os.Stderr
|
cmd.Stdout = os.Stdout
|
||||||
err = cmd.Run()
|
cmd.Stderr = os.Stderr
|
||||||
if err != nil {
|
err = cmd.Run()
|
||||||
log.Fatalf("[FATAL] %v", err)
|
if err != nil {
|
||||||
|
log.Fatalf("[FATAL] %v", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in a new issue