]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
box: Only use systemd-pty-forward if stdout is connected to tty
authorDaanDeMeyer <daan.j.demeyer@gmail.com>
Mon, 25 Aug 2025 19:55:00 +0000 (21:55 +0200)
committerDaanDeMeyer <daan.j.demeyer@gmail.com>
Mon, 25 Aug 2025 19:56:45 +0000 (21:56 +0200)
Otherwise piping mkosi box output to less will hang on exit.

mkosi/__init__.py

index e760e928511b43c598285f396dc2385939c95576..d6636995643e5a4ee2653a15bafecd4b053844a2 100644 (file)
@@ -4195,7 +4195,7 @@ def run_box(args: Args, config: Config) -> None:
 
     cmdline = [*args.cmdline]
 
-    if sys.stdin.isatty() and config.find_binary("systemd-pty-forward"):
+    if sys.stdin.isatty() and sys.stdout.isatty() and config.find_binary("systemd-pty-forward"):
         cmdline = [
             "systemd-pty-forward",
             "--title=mkosi-sandbox",