mirror of
https://github.com/fankes/komari-agent.git
synced 2025-10-19 02:59:23 +08:00
feat: 添加对Darwin和FreeBSD的GPU及操作系统名称获取功能
This commit is contained in:
21
monitoring/unit/os_darwin.go
Normal file
21
monitoring/unit/os_darwin.go
Normal file
@@ -0,0 +1,21 @@
|
||||
//go:build darwin
|
||||
// +build darwin
|
||||
|
||||
package monitoring
|
||||
|
||||
import (
|
||||
"os/exec"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// OSName returns the name of the operating system on Darwin (macOS)
|
||||
func OSName() string {
|
||||
cmd := exec.Command("sw_vers", "-productName")
|
||||
output, err := cmd.Output()
|
||||
if err != nil {
|
||||
return "macOS"
|
||||
}
|
||||
|
||||
name := strings.TrimSpace(string(output))
|
||||
return name
|
||||
}
|
Reference in New Issue
Block a user