]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
systemctl: color ignored exit status in yellow, not red
authorChristian Hesse <mail@eworm.de>
Fri, 30 Sep 2022 08:26:43 +0000 (10:26 +0200)
committerLuca Boccassi <luca.boccassi@gmail.com>
Fri, 30 Sep 2022 14:02:50 +0000 (15:02 +0100)
If the executable path is prefixed with "-", an exit code of the command
normally considered a failure (i.e. non-zero exit status or abnormal exit
due to signal) is recorded, but has no further effect and is considered
equivalent to success.

Let's honor this with `systemctl status`, and color ignored exit status
in yellow, not red.

src/systemctl/systemctl-show.c

index beeffda316c48d713e152d6f5a3c5f5be387325a..4c7094678c9341db3f32abd0cd84d2b1d37835f0 100644 (file)
@@ -584,7 +584,7 @@ static void print_status_info(
 
                 good = is_clean_exit(p->code, p->status, EXIT_CLEAN_DAEMON, NULL);
                 if (!good) {
-                        on = ansi_highlight_red();
+                        on = p->ignore ? ansi_highlight_yellow() : ansi_highlight_red();
                         off = ansi_normal();
                 } else
                         on = off = "";