mirror of
https://github.com/jimeh/macos-battery-exporter.git
synced 2026-02-19 01:16:40 +00:00
fix(battery): find ioreg executable more reliably
This commit is contained in:
@@ -34,7 +34,15 @@ type batteryRaw struct {
|
||||
}
|
||||
|
||||
func getAllRaw() ([]*batteryRaw, error) {
|
||||
b, err := exec.Command("ioreg", "-ra", "-c", "AppleSmartBattery").Output()
|
||||
ioreg, err := exec.LookPath("ioreg")
|
||||
if err != nil {
|
||||
ioreg, err = exec.LookPath("/usr/sbin/ioreg")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
b, err := exec.Command(ioreg, "-ra", "-c", "AppleSmartBattery").Output()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user