mirror of
https://github.com/troglobit/finit.git
synced 2026-11-13 17:00:16 +00:00
Fix progress print-out ordering bug, and run HOOK_SVC_START only on success
Only run HOOK_SVC_START on successful start, and *after* having printed the result of the started service, otherwise any print-outs from plugins or tasks we start may overwrite the started service's progress. Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
9c423dfca4
commit
594476c4fc
1 file changed
+10
-3
+10
-3
@@ -311,8 +311,6 @@ static int service_start(svc_t *svc)
|
|||||||
close(svc->stdin_fd);
|
close(svc->stdin_fd);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
plugin_run_hook(HOOK_SVC_START, (void *)(uintptr_t)pid);
|
|
||||||
|
|
||||||
if (SVC_TYPE_RUN == svc->type) {
|
if (SVC_TYPE_RUN == svc->type) {
|
||||||
result = WEXITSTATUS(complete(svc->cmd, pid));
|
result = WEXITSTATUS(complete(svc->cmd, pid));
|
||||||
if (!svc_clean_bootstrap(svc)) {
|
if (!svc_clean_bootstrap(svc)) {
|
||||||
@@ -322,8 +320,17 @@ static int service_start(svc_t *svc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
sigprocmask(SIG_SETMASK, &omask, NULL);
|
sigprocmask(SIG_SETMASK, &omask, NULL);
|
||||||
|
print_result(result);
|
||||||
|
|
||||||
return print_result(result);
|
/*
|
||||||
|
* Only run hook on successful start, and *after* having printed
|
||||||
|
* the result, otherwise any hook tasks may overwrite it and the
|
||||||
|
* result would be like double "[ OK ]" but only one service.
|
||||||
|
*/
|
||||||
|
if (!result)
|
||||||
|
plugin_run_hook(HOOK_SVC_START, (void *)(uintptr_t)pid);
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in new issue
Block a user