diff options
author | Carlos Fernández <sirikon2@gmail.com> | 2017-02-21 20:48:38 +0100 |
---|---|---|
committer | Carlos Fernández <sirikon2@gmail.com> | 2017-02-21 20:48:38 +0100 |
commit | 2051441d32611372bf8e164f930e9c664fcd5f2d (patch) | |
tree | cfd28f987ae981f797578912145108a3ed768901 | |
parent | 39e0708be1b57b5527f4c79708b25067ba50f86e (diff) |
Fix Windows build & run
-rw-r--r-- | cmd/ponzu/main.go | 2 | ||||
-rw-r--r-- | cmd/ponzu/options.go | 2 | ||||
-rw-r--r-- | cmd/ponzu/paths.go | 12 |
3 files changed, 14 insertions, 2 deletions
diff --git a/cmd/ponzu/main.go b/cmd/ponzu/main.go index d064569..cad53ba 100644 --- a/cmd/ponzu/main.go +++ b/cmd/ponzu/main.go @@ -146,7 +146,7 @@ func main() { services = "admin,api" } - serve := exec.Command("./ponzu-server", + serve := exec.Command(GetPonzuServerBuildOutputFileName(), fmt.Sprintf("--port=%d", port), fmt.Sprintf("--httpsport=%d", httpsport), addTLS, diff --git a/cmd/ponzu/options.go b/cmd/ponzu/options.go index 43f6e05..c95d68c 100644 --- a/cmd/ponzu/options.go +++ b/cmd/ponzu/options.go @@ -302,7 +302,7 @@ func buildPonzuServer(args []string) error { } // execute go build -o ponzu-cms cmd/ponzu/*.go - buildOptions := []string{"build", "-o", "ponzu-server"} + buildOptions := []string{"build", "-o", GetPonzuServerBuildOutputFileName()} cmdBuildFiles := []string{"main.go", "options.go", "generate.go", "usage.go"} var cmdBuildFilePaths []string for _, file := range cmdBuildFiles { diff --git a/cmd/ponzu/paths.go b/cmd/ponzu/paths.go new file mode 100644 index 0000000..4bd4d41 --- /dev/null +++ b/cmd/ponzu/paths.go @@ -0,0 +1,12 @@ +package main + +import "runtime" + +// GetPonzuServerBuildOutputFileName returns de correct +// ponzu-server file name based on the host Operating System +func GetPonzuServerBuildOutputFileName() string { + if runtime.GOOS == "windows" { + return "ponzu-server.exe" + } + return "ponzu-server" +} |