Skip to content

Commit

Permalink
svc.h: show exact result for run tasks
Browse files Browse the repository at this point in the history
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 <sergio.morlans@atlascopco.com>
Signed-off-by: Ming Liu <liu.ming50@gmail.com>
  • Loading branch information
linuxanonimous84 authored and liuming50 committed Mar 3, 2022
1 parent e73d4ee commit 7cb4e7a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/initctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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" : "");
Expand Down
2 changes: 1 addition & 1 deletion src/service.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)));

Expand Down
5 changes: 4 additions & 1 deletion src/svc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 7cb4e7a

Please sign in to comment.