Commit 03c44a3

Karn Wong <[email protected]>
2024-12-25 02:51:23
fix(getSystemInfo): ignore battery no such file or directory error for linux on mac devices tag: v0.4.1
1 parent 5ee039c
Changed files (2)
cmd/get/get_system_info.go
@@ -92,7 +92,11 @@ func getSystemInfo() SystemInfo {
 	// battery
 	batteries, err := battery.GetAll()
 	if err != nil {
-		log.Fatal().Err(err).Msg("Error getting battery info")
+		if strings.Contains(err.Error(), "no such file or directory") {
+			// ignore this happens on [linux on mac devices]
+		} else {
+			log.Fatal().Err(err).Msg("Error getting battery info")
+		}
 	}
 
 	var batteryCurrent float64
go.sum
@@ -83,8 +83,6 @@ github.com/sethvargo/go-password v0.3.1 h1:WqrLTjo7X6AcVYfC6R7GtSyuUQR9hGyAj/f1P
 github.com/sethvargo/go-password v0.3.1/go.mod h1:rXofC1zT54N7R8K/h1WDUdkf9BOx5OptoxrMBcrXzvs=
 github.com/shirou/gopsutil/v4 v4.24.11 h1:WaU9xqGFKvFfsUv94SXcUPD7rCkU0vr/asVdQOBZNj8=
 github.com/shirou/gopsutil/v4 v4.24.11/go.mod h1:s4D/wg+ag4rG0WO7AiTj2BeYCRhym0vM7DHbZRxnIT8=
-github.com/showwin/speedtest-go v1.7.9 h1:5b3T3U3WSppVXFqsIqF1zdHRYKKVuPNpzFU71HnYNEY=
-github.com/showwin/speedtest-go v1.7.9/go.mod h1:uLgdWCNarXxlYsL2E5TOZpCIwpgSWnEANZp7gfHXHu0=
 github.com/showwin/speedtest-go v1.7.10 h1:9o5zb7KsuzZKn+IE2//z5btLKJ870JwO6ETayUkqRFw=
 github.com/showwin/speedtest-go v1.7.10/go.mod h1:Ei7OCTmNPdWofMadzcfgq1rUO7mvJy9Jycj//G7vyfA=
 github.com/skanehira/clipboard-image v1.0.0 h1:MJ5PeXxDMteS0HCsjvuoMscBi+AtoqCiPX7bZ2OAxDE=