swaync-fbcli: fix CPU pegging
This commit is contained in:
parent
827c50ff43
commit
824046aca1
|
@ -28,21 +28,22 @@ start() {
|
|||
|
||||
trap cleanup SIGINT SIGQUIT SIGTERM
|
||||
|
||||
local extraFbcliArgs=()
|
||||
local timeout=
|
||||
case "$event" in
|
||||
phone-incoming-call)
|
||||
extraFbcliArgs=("-t" "20")
|
||||
timeout=20
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
local cli="fbcli --event $event ${timeout:+ -t $timeout}"
|
||||
|
||||
# feedbackd stops playback when the caller exits
|
||||
# and fbcli will exit immediately if it has no stdin.
|
||||
# so spoof a stdin.
|
||||
# TODO: this maybe pegs CPU at 100% when receiving a call, and never exits?
|
||||
log "fbcli --event $event ${extraFbcliArgs[*]}"
|
||||
/bin/sh -c "true | fbcli --event $event ${extraFbcliArgs[*]}" &
|
||||
log "$cli"
|
||||
/bin/sh -c "sleep $((3 ${timeout:+ + $timeout})) | $cli" &
|
||||
child=$!
|
||||
wait
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user