From 2748eff01251d33983bb16b047578d21db11e3ae Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Tue, 10 Mar 2026 10:57:01 +0000 Subject: [PATCH] [console] Flush line-based console after each progress update Download progress messages will not currently appear via the syslog console (or any other line buffering console) until the download completes and the newline character is printed. Use the ASCII unit separator (US) character to indicate the end of each per-second progress message, and modify the line console to react to this character by sending out the incomplete line. Suggested-by: Christian I. Nilsson Signed-off-by: Michael Brown --- src/core/lineconsole.c | 6 ++++++ src/core/monojob.c | 1 + src/include/ipxe/keys.h | 1 + 3 files changed, 8 insertions(+) diff --git a/src/core/lineconsole.c b/src/core/lineconsole.c index 9488d500e..897fabece 100644 --- a/src/core/lineconsole.c +++ b/src/core/lineconsole.c @@ -60,6 +60,12 @@ size_t line_putchar ( struct line_console *line, int character ) { if ( character == CR ) return 0; + /* Handle unit separator (to print without resetting) */ + if ( character == US ) { + line->buffer[line->index] = 0; + return 1; + } + /* Treat newline as a terminator */ if ( character == LF ) character = 0; diff --git a/src/core/monojob.c b/src/core/monojob.c index ff22b4ac8..24eb21824 100644 --- a/src/core/monojob.c +++ b/src/core/monojob.c @@ -156,6 +156,7 @@ int monojob_wait ( const char *string, unsigned long timeout ) { clear_len += printf ( " [%s]", progress.message ); } + putchar ( US ); last_display = now; } } diff --git a/src/include/ipxe/keys.h b/src/include/ipxe/keys.h index b2a62744e..8de7493b7 100644 --- a/src/include/ipxe/keys.h +++ b/src/include/ipxe/keys.h @@ -48,6 +48,7 @@ FILE_SECBOOT ( PERMITTED ); #define LF CTRL_J #define CR CTRL_M #define ESC 0x1b +#define US 0x1f #define DEL 0x7f /*