]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
nspawn: hide ^] hint unless we are interactive mode 31458/head
authorLennart Poettering <lennart@poettering.net>
Fri, 23 Feb 2024 11:30:19 +0000 (12:30 +0100)
committerLennart Poettering <lennart@poettering.net>
Mon, 26 Feb 2024 10:55:11 +0000 (11:55 +0100)
The hotkey only works in interactive mode hence don't mislead users
about it.

src/nspawn/nspawn.c

index cd398f2461f58ec989f1d482f0e614627f5f597d..1cb039ade4ae99407ee11fe1dd6bc332034a0ac3 100644 (file)
@@ -5991,10 +5991,12 @@ static int run(int argc, char *argv[]) {
                 _cleanup_free_ char *u = NULL;
                 (void) terminal_urlify_path(t, t, &u);
 
-                log_info("%s %sSpawning container %s on %s.%s\n"
-                         "%s %sPress %sCtrl-]%s three times within 1s to kill container.%s",
-                         special_glyph(SPECIAL_GLYPH_LIGHT_SHADE), ansi_grey(), arg_machine, u ?: t, ansi_normal(),
-                         special_glyph(SPECIAL_GLYPH_LIGHT_SHADE), ansi_grey(), ansi_highlight(), ansi_grey(), ansi_normal());
+                log_info("%s %sSpawning container %s on %s.%s",
+                         special_glyph(SPECIAL_GLYPH_LIGHT_SHADE), ansi_grey(), arg_machine, u ?: t, ansi_normal());
+
+                if (arg_console_mode == CONSOLE_INTERACTIVE)
+                        log_info("%s %sPress %sCtrl-]%s three times within 1s to kill container.%s",
+                                 special_glyph(SPECIAL_GLYPH_LIGHT_SHADE), ansi_grey(), ansi_highlight(), ansi_grey(), ansi_normal());
         }
 
         assert_se(sigprocmask_many(SIG_BLOCK, NULL, SIGCHLD, SIGWINCH, SIGTERM, SIGINT, SIGRTMIN+18) >= 0);