2 Commits

Author SHA1 Message Date
github-actions[bot]
cdac9396fc chore(main): release 0.0.2 (#3)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-12-16 01:39:26 +00:00
993b036d99 fix(battery): find ioreg executable more reliably 2023-12-16 01:36:04 +00:00
3 changed files with 17 additions and 2 deletions

View File

@@ -1,3 +1,3 @@
{
".": "0.0.1"
".": "0.0.2"
}

View File

@@ -1,5 +1,12 @@
# Changelog
## [0.0.2](https://github.com/jimeh/macos-battery-exporter/compare/v0.0.1...v0.0.2) (2023-12-16)
### Bug Fixes
* **battery:** find ioreg executable more reliably ([993b036](https://github.com/jimeh/macos-battery-exporter/commit/993b036d99362b6bebd36545fc34d325863421d5))
## 0.0.1 (2023-12-16)

View File

@@ -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
}