fixes for windows
This commit is contained in:
parent
c2508127b4
commit
fd70f428ae
@ -1,21 +0,0 @@
|
||||
image: golang:1.15
|
||||
|
||||
pipelines:
|
||||
default:
|
||||
- parallel:
|
||||
- step:
|
||||
name: Test and Build
|
||||
script:
|
||||
- go mod vendor
|
||||
- go mod tidy
|
||||
- go test -v
|
||||
- mkdir build
|
||||
- ./build.sh
|
||||
- export BUILDPATH="build/$(uname)/gostations"
|
||||
- curl -X POST --user "${BITBUCKET_USERNAME}:${BITBUCKET_APP_PASSWORD}" "https://api.bitbucket.org/2.0/repositories/${BITBUCKET_REPO_OWNER}/${BITBUCKET_REPO_SLUG}/downloads" --form files=@"${BUILDPATH}"
|
||||
|
||||
- step:
|
||||
name: Lint code
|
||||
image: golangci/golangci-lint:v1.31.0
|
||||
script:
|
||||
- golangci-lint run -v
|
13
commander.go
13
commander.go
@ -4,10 +4,21 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"runtime"
|
||||
)
|
||||
|
||||
func isInstalled(name string) bool {
|
||||
cmd := exec.Command("/bin/sh", "-c", "command -v " + name)
|
||||
var cmd *exec.Cmd
|
||||
|
||||
// check for the operating system
|
||||
if runtime.GOOS == "windows" {
|
||||
// 'where' command is used on Windows to locate executables
|
||||
cmd = exec.Command("where.exe", name)
|
||||
} else {
|
||||
// 'command' is used on Unix systems
|
||||
cmd = exec.Command("/bin/sh", "-c", "command -v "+name)
|
||||
}
|
||||
|
||||
if err := cmd.Run(); err != nil {
|
||||
return false
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user