gostations/commander.go
Greg Gauthier 07586a8fc0
Some checks failed
gobuild / build (push) Failing after 7s
fix(commander): capture output via CombinedOutput instead of piping streams
- Remove os import and manual Stdin/Stdout/Stderr assignment from subExecute
- Replace cmd.Run() followed by cmd.CombinedOutput() with single CombinedOutput call
- Adjust volume bar height to exactly match metadata display and increase gap to 2 spaces
2026-06-05 23:34:09 +01:00

35 lines
671 B
Go

package main
import (
"fmt"
"os/exec"
"runtime"
)
func isInstalled(name string) bool {
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
}
return true
}
func subExecute(program string, args ...string) ([]byte, error) {
cmd := exec.Command(program, args...)
output, err := cmd.CombinedOutput()
if err != nil {
fmt.Printf("%v\n", err)
}
return output, err
}