From 7cb4e7a16d51c7ad9b65184111a9e61d6f769bb1 Mon Sep 17 00:00:00 2001 From: Sergio Morlans Date: Thu, 3 Mar 2022 16:25:57 +0100 Subject: [PATCH] svc.h: show exact result for run tasks Instead showing a 'done' result for run tasks, now we change to show the exact result of the executed shell script: succeeded or failed. Signed-off-by: Sergio Morlans Signed-off-by: Ming Liu --- src/initctl.c | 2 +- src/service.c | 2 +- src/svc.h | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/initctl.c b/src/initctl.c index 67e0e6a3..e91a6933 100644 --- a/src/initctl.c +++ b/src/initctl.c @@ -738,7 +738,7 @@ static char *status(svc_t *svc, int full) color = NULL; if (!full) - snprintf(buf, sizeof(buf), "%-8.8s", s); + snprintf(buf, sizeof(buf), "%-10.10s", s); else snprintf(buf, sizeof(buf), "%s%s%s%s", color ? color : "", s, ok, color ? "\e[0m" : ""); diff --git a/src/service.c b/src/service.c index 81e555e3..5986c061 100644 --- a/src/service.c +++ b/src/service.c @@ -1749,7 +1749,7 @@ int service_step(svc_t *svc) old_state = svc->state; enabled = svc_enabled(svc); - _d("%20s(%4d): %8s %3sabled/%-7s cond:%-4s", svc->cmd, svc->pid, + _d("%20s(%4d): %10s %3sabled/%-7s cond:%-4s", svc->cmd, svc->pid, svc_status(svc), enabled ? "en" : "dis", svc_dirtystr(svc), condstr(cond_get_agg(svc->cond))); diff --git a/src/svc.h b/src/svc.h index 3a670fe4..8cc38e17 100644 --- a/src/svc.h +++ b/src/svc.h @@ -332,7 +332,10 @@ static inline char *svc_status(svc_t *svc) return "unknown"; case SVC_DONE_STATE: - return "done"; + if (svc->started) + return "succeeded"; + else + return "failed"; case SVC_STOPPING_STATE: switch (svc->type) {