Let manual:yes run/tasks also end in state 'done'

This is a follow-up to #274, in which Andy pointed out that ending up in
state 'stopped' was a bit confusing for manual:yes run/tasks.

With the following change we let all run/tasks end in state 'done', yet
still allow manual:yes ones to transition to 'ready' when the user calls
`initctl start foo`.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2022-06-25 15:41:34 +02:00
1 parent fbcd7d2384
commit 96257cc5c7
2 files changed
+5 -4

No files matched your search

+4 -4
View File
@@ -1893,6 +1893,8 @@ restart:
case SVC_DONE_STATE:
if (svc_is_changed(svc))
svc_set_state(svc, SVC_HALTED_STATE);
if (svc_is_runtask(svc) && svc_is_manual(svc) && enabled)
svc_set_state(svc, SVC_READY_STATE);
break;
case SVC_STOPPING_STATE:
@@ -1916,11 +1918,9 @@ restart:
case SVC_TYPE_TASK:
case SVC_TYPE_RUN:
if (svc->manual) {
if (svc->manual)
svc_stop(svc);
svc_set_state(svc, SVC_HALTED_STATE);
} else
svc_set_state(svc, SVC_DONE_STATE);
svc_set_state(svc, SVC_DONE_STATE);
break;
default: