From b4679016f3cac2cd13c29612cd12ac358ec1bcef Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 23 Feb 2024 12:30:19 +0100 Subject: [PATCH] nspawn: hide ^] hint unless we are interactive mode The hotkey only works in interactive mode hence don't mislead users about it. --- src/nspawn/nspawn.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c index cd398f2461f..1cb039ade4a 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c @@ -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); -- 2.47.3