From 9b1c23987c20509067f44e671c7a3da160e8a1b6 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 13 Jul 2022 21:40:55 +0530 Subject: [PATCH] Fix stdout line_buffering incorrect when parent kitty instance has its stdout redirected to a file --- kitty/prewarm.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kitty/prewarm.py b/kitty/prewarm.py index 3e1e10e6d..9c13f8c72 100644 --- a/kitty/prewarm.py +++ b/kitty/prewarm.py @@ -828,6 +828,8 @@ def exec_main(stdin_read: int, stdout_write: int, death_notify_write: int, unix_ if unix_socket is None: unix_socket = random_unix_socket() os.write(stdout_write, f'{get_socket_name(unix_socket)}\n'.encode('utf-8')) + if not sys.stdout.line_buffering: # happens if the parent kitty instance has stdout not pointing to a terminal + sys.stdout.reconfigure(line_buffering=True) # type: ignore try: main(stdin_read, stdout_write, death_notify_write, unix_socket) finally: