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.
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]: