Don't shell out to obtain process and system stats

This commit is contained in:
Dan Kortschak
2022-04-24 17:46:57 +09:30
committed by Jakub
parent f40f002bf9
commit 5c28a3eda7
3 changed files with 33 additions and 36 deletions

View File

@ -21,12 +21,13 @@
package theme
import (
"os/exec"
"strings"
"golang.org/x/sys/execabs"
)
func detectSystemTheme() Theme {
out, err := exec.Command("defaults", "read", "-g", "AppleInterfaceStyle").Output() //nolint:gosec
out, err := execabs.Command("defaults", "read", "-g", "AppleInterfaceStyle").Output() //nolint:gosec
if err == nil && strings.TrimSpace(string(out)) == "Dark" {
return Dark
}