summaryrefslogtreecommitdiff
path: root/src/systemctl.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2011-01-20 18:22:03 +0100
committerLennart Poettering <lennart@poettering.net>2011-01-20 18:22:03 +0100
commit9a57c62944258c750d80bca4fe56de4dbab46d67 (patch)
tree7194ffec3e7e66b63a9e457b8a79be9c25daeafb /src/systemctl.c
parent0129173ab03994d21a21f9fc1f454faf62b97043 (diff)
systemctl: highlight failed processes in systemctl status
Diffstat (limited to 'src/systemctl.c')
-rw-r--r--src/systemctl.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/systemctl.c b/src/systemctl.c
index f93f2aa480..fb3430048c 100644
--- a/src/systemctl.c
+++ b/src/systemctl.c
@@ -1847,15 +1847,31 @@ static void print_status_info(UnitStatusInfo *i) {
LIST_FOREACH(exec, p, i->exec) {
char *t;
+ bool good;
/* Only show exited processes here */
if (p->code == 0)
continue;
t = strv_join(p->argv, " ");
- printf("\t Process: %u %s=%s (code=%s, ", p->pid, p->name, strna(t), sigchld_code_to_string(p->code));
+ printf("\t Process: %u %s=%s ", p->pid, p->name, strna(t));
free(t);
+#ifdef HAVE_SYSV_COMPAT
+ if (i->is_sysv)
+ good = is_clean_exit_lsb(p->code, p->status);
+ else
+#endif
+ good = is_clean_exit(p->code, p->status);
+
+ if (!good) {
+ on = ansi_highlight(true);
+ off = ansi_highlight(false);
+ } else
+ on = off = "";
+
+ printf("%s(code=%s, ", on, sigchld_code_to_string(p->code));
+
if (p->code == CLD_EXITED) {
const char *c;
@@ -1870,7 +1886,10 @@ static void print_status_info(UnitStatusInfo *i) {
} else
printf("signal=%s", signal_to_string(p->status));
- printf(")\n");
+
+ printf(")%s\n", off);
+
+ on = off = NULL;
if (i->main_pid == p->pid &&
i->start_timestamp == p->start_timestamp &&