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