File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed
Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -193,14 +193,14 @@ function setup_acpi {
193193# Creates a `upower` function that simulates output like the real `upower` command.
194194# The passed in parameter is used for the remaining battery percentage.
195195function setup_upower {
196+ trap -p PIPE | grep -q PIPE || trap ' ' PIPE
196197 percent=" $1 "
197198 BAT0=" /org/freedesktop/UPower/devices/battery_BAT$RANDOM "
198199
199200 function upower {
200201 case $1 in
201202 ' -e' |' --enumerate' )
202- # don't just `echo` twice because `grep` will close the pipe after matching the first line...
203- echo " $BAT0 " $' \n ' " /org/freedesktop/UPower/devices/mouse_hid_${RANDOM} _battery"
203+ printf ' %s\n' " $BAT0 " " /org/freedesktop/UPower/devices/mouse_hid_${RANDOM} _battery"
204204 ;;
205205 ' -i' |' --show-info' )
206206 if [[ $2 == " $BAT0 " ]]
You can’t perform that action at this time.
0 commit comments