summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/job.c4
-rw-r--r--src/core/manager.c16
-rw-r--r--src/core/manager.h1
3 files changed, 17 insertions, 4 deletions
diff --git a/src/core/job.c b/src/core/job.c
index fb6709edf7..93fa44a506 100644
--- a/src/core/job.c
+++ b/src/core/job.c
@@ -632,15 +632,18 @@ static void job_print_status_message(Unit *u, JobType t, JobResult result) {
break;
case JOB_FAILED:
+ manager_flip_auto_status(u->manager, true);
unit_status_printf(u, ANSI_HIGHLIGHT_RED_ON "FAILED" ANSI_HIGHLIGHT_OFF, format);
manager_status_printf(u->manager, false, NULL, "See 'systemctl status %s' for details.", u->id);
break;
case JOB_DEPENDENCY:
+ manager_flip_auto_status(u->manager, true);
unit_status_printf(u, ANSI_HIGHLIGHT_YELLOW_ON "DEPEND" ANSI_HIGHLIGHT_OFF, format);
break;
case JOB_TIMEOUT:
+ manager_flip_auto_status(u->manager, true);
unit_status_printf(u, ANSI_HIGHLIGHT_RED_ON " TIME " ANSI_HIGHLIGHT_OFF, format);
break;
@@ -657,6 +660,7 @@ static void job_print_status_message(Unit *u, JobType t, JobResult result) {
switch (result) {
case JOB_TIMEOUT:
+ manager_flip_auto_status(u->manager, true);
unit_status_printf(u, ANSI_HIGHLIGHT_RED_ON " TIME " ANSI_HIGHLIGHT_OFF, format);
break;
diff --git a/src/core/manager.c b/src/core/manager.c
index 9f615e64eb..edde1091c4 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -136,6 +136,16 @@ static void draw_cylon(char buffer[], size_t buflen, unsigned width, unsigned po
}
}
+void manager_flip_auto_status(Manager *m, bool enable) {
+ if (enable) {
+ if (m->show_status == SHOW_STATUS_AUTO)
+ manager_set_show_status(m, SHOW_STATUS_TEMPORARY);
+ } else {
+ if (m->show_status == SHOW_STATUS_TEMPORARY)
+ manager_set_show_status(m, SHOW_STATUS_AUTO);
+ }
+}
+
static void manager_print_jobs_in_progress(Manager *m) {
_cleanup_free_ char *job_of_n = NULL;
Iterator i;
@@ -148,8 +158,7 @@ static void manager_print_jobs_in_progress(Manager *m) {
assert(m);
- if (m->show_status == SHOW_STATUS_AUTO)
- manager_set_show_status(m, SHOW_STATUS_TEMPORARY);
+ manager_flip_auto_status(m, true);
print_nr = (m->jobs_in_progress_iteration / JOBS_IN_PROGRESS_PERIOD_DIVISOR) % m->n_running_jobs;
@@ -2459,8 +2468,7 @@ void manager_check_finished(Manager *m) {
return;
}
- if (m->show_status == SHOW_STATUS_TEMPORARY)
- manager_set_show_status(m, SHOW_STATUS_AUTO);
+ manager_flip_auto_status(m, false);
/* Notify Type=idle units that we are done now */
m->idle_pipe_event_source = sd_event_source_unref(m->idle_pipe_event_source);
diff --git a/src/core/manager.h b/src/core/manager.h
index 3065822cfa..358aba7ff9 100644
--- a/src/core/manager.h
+++ b/src/core/manager.h
@@ -299,5 +299,6 @@ void manager_recheck_journal(Manager *m);
void manager_set_show_status(Manager *m, ShowStatus mode);
void manager_status_printf(Manager *m, bool ephemeral, const char *status, const char *format, ...) _printf_(4,5);
+void manager_flip_auto_status(Manager *m, bool enable);
Set *manager_get_units_requiring_mounts_for(Manager *m, const char *path);