Skip to content

Commit 1e656e6

Browse files
committed
Pull Status ONLY IF there is Status Available to Pull
1 parent 95a6843 commit 1e656e6

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

scripts/helpers.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,11 @@ command_exists() {
3838

3939
battery_status() {
4040
if is_wsl; then
41-
local battery
42-
battery=$(find /sys/class/power_supply/*/status | tail -n1)
43-
awk '{print tolower($0);}' "$battery"
41+
if [ -e /sys/class/power_supply/*/status ]; then
42+
local battery
43+
battery=$(find /sys/class/power_supply/*/status | tail -n1)
44+
awk '{print tolower($0);}' "$battery"
45+
fi
4446
elif command_exists "pmset"; then
4547
pmset -g batt | awk -F '; *' 'NR==2 { print $2 }'
4648
elif command_exists "acpi"; then

0 commit comments

Comments
 (0)