Fix stdout line_buffering incorrect when parent kitty instance has its stdout redirected to a file
This commit is contained in:
parent
784daa1a4b
commit
9b1c23987c
@ -828,6 +828,8 @@ def exec_main(stdin_read: int, stdout_write: int, death_notify_write: int, unix_
|
|||||||
if unix_socket is None:
|
if unix_socket is None:
|
||||||
unix_socket = random_unix_socket()
|
unix_socket = random_unix_socket()
|
||||||
os.write(stdout_write, f'{get_socket_name(unix_socket)}\n'.encode('utf-8'))
|
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:
|
try:
|
||||||
main(stdin_read, stdout_write, death_notify_write, unix_socket)
|
main(stdin_read, stdout_write, death_notify_write, unix_socket)
|
||||||
finally:
|
finally:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user