Fix up the background process handler.

This commit is contained in:
stormdragon2976 2023-01-30 20:34:00 -05:00
parent ae0cc60a79
commit 0ce5af2bc4

View File

@ -4,12 +4,7 @@
# Let's see how far we can get. :)
# Handle subprocesses that may not close with the main program.
trap cleanup EXIT
cleanup() {
if [[ $bgLoop -ne 0 ]]; then
trap 'pkill -P $$' EXIT
fi
}
trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT
# Display usage information.
@ -191,7 +186,7 @@ done
mkdir -p "${configPath}/soundpacks"
# Keep track of the backgrounded loop
bgLoop=0
bgLoop=1
# Associative array of command line parameters and short description of what they do.
declare -A command=(
@ -233,9 +228,9 @@ done
# Main loops
# Display timelines and requested information.
# Important, set bgLoop to 0 or this loop will not close with the program
bgLoop=0
while : ; do
# Important, set bgLoop to 1 or this loop will not close with the program
bgLoop=1
if [[ -n "${since_id}" ]]; then
result="$(curl -sS --oauth2-bearer "${oauth_token}" "${instanceURL}/api/va/timelines/${timeline:-home}?since_id=${since_id}")"
else