]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
log: make OSC escape sequences valid
authorJörg Behrmann <behrmann@physik.fu-berlin.de>
Wed, 22 Oct 2025 11:53:56 +0000 (13:53 +0200)
committerJörg Behrmann <behrmann@physik.fu-berlin.de>
Thu, 23 Oct 2025 08:19:10 +0000 (10:19 +0200)
OSC escape sequences ("ESC ]" aka "\033]") need to be terminated with a string
terminator code ST ("\033\").

Commit f26cb341 introduced some OSC escape sequences that resulted in all mkosi
output being hidden when using the Kitty terminal:
https://github.com/kovidgoyal/kitty/issues/9139

Fixes: f26cb341
Co-Authored-By: j <j@cgl.sh>
mkosi/log.py

index 0ad3d034200e586a127bb97c1264f52fc08b4b11..889c8814b20862cdfa85b3b8c882d3af43d4c314 100644 (file)
@@ -33,11 +33,14 @@ def log_step(text: str) -> None:
         # easily which step generated the exception. The exception
         # or error will only be printed after we finish cleanup.
         if not terminal_is_dumb():
-            print(f"\033]0;mkosi: {text}", file=sys.stderr, end="")
+            print(f"\033]0;mkosi: {text}\033\\", file=sys.stderr, end="")
+            # konsole does not support ESC ]0; title ST, but instead supports this
+            print(f"\033]30;mkosi: {text}\033\\", file=sys.stderr, end="")
         logging.info(f"{prefix}({text})")
     else:
         if not terminal_is_dumb():
-            print(f"\033]0;mkosi: {text}", file=sys.stderr, end="")
+            print(f"\033]0;mkosi: {text}\033\\", file=sys.stderr, end="")
+            print(f"\033]30;mkosi: {text}\033\\", file=sys.stderr, end="")
         logging.info(f"{prefix}{Style.bold}{text}{Style.reset}")