From 9a2ee9260d6269a56d0b13ae722634216e589bbd Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Sun, 21 Apr 2024 11:20:09 +0200 Subject: [PATCH] Always use TERM=dumb if not connected to a tty mkosi might be invoked from a terminal but redirected to a file, in that case we should ignore $TERM from the environment, so let's make sure we handle that properly. --- mkosi/config.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mkosi/config.py b/mkosi/config.py index cccbcdf9e..6bb2441e8 100644 --- a/mkosi/config.py +++ b/mkosi/config.py @@ -3697,10 +3697,11 @@ def load_credentials(args: argparse.Namespace) -> dict[str, str]: def finalize_term() -> str: - if not (term := os.getenv("TERM")) or term == "unknown": + term = os.getenv("TERM", "unknown") + if term == "unknown": term = "vt220" if sys.stderr.isatty() else "dumb" - return term + return term if sys.stderr.isatty() else "dumb" def load_kernel_command_line_extra(args: argparse.Namespace) -> list[str]: -- 2.47.2