From: Daan De Meyer Date: Sun, 21 Apr 2024 09:20:09 +0000 (+0200) Subject: Always use TERM=dumb if not connected to a tty X-Git-Tag: v23.1~103^2 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F2646%2Fhead;p=thirdparty%2Fmkosi.git 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. --- 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]: