From 1c38262641804b2bb9d9d743b5014bfb792db35c Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Fri, 9 Aug 2019 23:09:12 -0600 Subject: [PATCH] bugfix pathman / serviceman links windows --- build-all.go | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/build-all.go b/build-all.go index 957f46e..8b75241 100644 --- a/build-all.go +++ b/build-all.go @@ -236,11 +236,22 @@ func main() { pkg.os, arch, ) - pathmanFile := filepath.Join(outdir, "bin", "pathman") + pkg.exe + pathmanFile := filepath.Join(outdir, "node_modules/.bin", "pathman") + pkg.exe err = download("pathman", pathmanURL, pathmanFile, true) if nil != err { panic(err) } + if ".exe" == pkg.exe { + sh := strings.Join([]string{ + `#!/usr/bin/env bash`, + `"$(dirname "$0")/pathman.exe" "$@"`, + `exit $?`, + }, "\n") + script := filepath.Join(outdir, "node_modules/.bin", "pathman") + if err := ioutil.WriteFile(script, []byte(sh), 0755); nil != err { + panic(err) + } + } // Get serviceman for the platform servicemanURL := fmt.Sprintf( @@ -248,11 +259,22 @@ func main() { pkg.os, arch, ) - servicemanFile := filepath.Join(outdir, "bin", "serviceman") + pkg.exe + servicemanFile := filepath.Join(outdir, "node_modules/.bin", "serviceman") + pkg.exe err = download("serviceman", servicemanURL, servicemanFile, true) if nil != err { panic(err) } + if ".exe" == pkg.exe { + sh := strings.Join([]string{ + `#!/usr/bin/env bash`, + `"$(dirname "$0")/serviceman.exe" "$@"`, + `exit $?`, + }, "\n") + script := filepath.Join(outdir, "node_modules/.bin", "serviceman") + if err := ioutil.WriteFile(script, []byte(sh), 0755); nil != err { + panic(err) + } + } // Write out the packaged deliverable f, err := os.OpenFile(outdir+"."+pkg.ext, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0644)