terminal-util: add new helper terminal_reset_defensive() that combines reset-by-ioctl and reset-by-sequence reasonably

This commit is contained in:
Lennart Poettering
2024-07-19 11:41:43 +02:00
parent ce3a1593bc
commit cfac09083b
8 changed files with 36 additions and 8 deletions
+1 -1
View File
@@ -133,7 +133,7 @@ static void print_welcome(int rfd) {
pn = os_release_pretty_name(pretty_name, os_name);
ac = isempty(ansi_color) ? "0" : ansi_color;
(void) reset_terminal_fd(STDIN_FILENO, /* switch_to_text= */ false);
(void) terminal_reset_defensive(STDIN_FILENO, /* switch_to_text= */ false);
if (colors_enabled())
printf("\nWelcome to your new installation of \x1B[%sm%s\x1B[0m!\n", ac, pn);