fail if the setup function fucks up

Signed-off-by: fbt <fbt@fleshless.org>
This commit is contained in:
2026-11-29 10:03:25 +00:00
parent 77358b2955
commit 11d7d92326
+7 -3
View File
@@ -222,7 +222,11 @@ svc() {
fi fi
# Some setup might be required on each loop # Some setup might be required on each loop
run_service_action 'setup' run_service_action 'setup' || {
printf 'Setup function failed, bailing!\n' >&2
job_exit=127
break
}
# Spawn the process and record the PID # Spawn the process and record the PID
spawn "$@" & job_pid = "$!" spawn "$@" & job_pid = "$!"
@@ -233,7 +237,7 @@ svc() {
# We need to wait for the service to write down its pidfile # We need to wait for the service to write down its pidfile
until service_pidfile is file; do until service_pidfile is file; do
(( counter >= service_pidfile_timeout*10 )) && { (( counter >= service_pidfile_timeout*10 )) && {
printf 'Timed out waiting for pidfile: %s' "$service_pidfile" >&2 printf 'Timed out waiting for pidfile: %s\n' "$service_pidfile" >&2
job_exit=127 job_exit=127
break break
} }
@@ -253,7 +257,7 @@ svc() {
# Fail if the pid doesn't look right # Fail if the pid doesn't look right
printf -v _ '%d' "$job_pid" || { printf -v _ '%d' "$job_pid" || {
printf 'Job PID in %s seems to be malformed' "$service_pidfile" >&2 printf 'Job PID in %s seems to be malformed\n' "$service_pidfile" >&2
job_exit=127 job_exit=127
break break
} }