cmdline = [*args.cmdline]
if sys.stdin.isatty() and sys.stdout.isatty():
- cmdline = systemd_pty_forward(config, "48;2;12;51;51", "mkosi-sandbox") + cmdline
+ cmdline = systemd_pty_forward(config, background="48;2;12;51;51", title="mkosi-sandbox") + cmdline
with contextlib.ExitStack() as stack:
if config.tools() != Path("/"):
return version
-def systemd_pty_forward(config: Config, background: str, title: str) -> list[str]:
+def systemd_pty_forward(
+ config: Config,
+ *,
+ background: Optional[str] = None,
+ title: Optional[str] = None,
+) -> list[str]:
tint_bg = parse_boolean(config.environment.get("SYSTEMD_TINT_BACKGROUND", "1")) and parse_boolean(
os.environ.get("SYSTEMD_TINT_BACKGROUND", "1")
)
return []
cmd = ["systemd-pty-forward"]
- if tint_bg:
- cmd += [f"--background={background}"]
- if adjust_title:
- cmd += ["--title=", title]
+ if tint_bg and background:
+ cmd += ["--background", background]
+ if adjust_title and title:
+ cmd += ["--title", title]
return cmd
if config.console in (ConsoleMode.interactive, ConsoleMode.read_only):
cmdline += systemd_pty_forward(
- config, "48;2;12;51;19", f"Virtual Machine {config.machine_or_name()}"
+ config,
+ background="48;2;12;51;19",
+ title=f"Virtual Machine {config.machine_or_name()}",
)
if config.console == ConsoleMode.read_only: