From 20cffc728e88da8a59f9a595ea8c2f08e28f50f3 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 11 Aug 2022 05:10:15 +0530 Subject: [PATCH] Close tty_fd after dup2 --- kitty/remote_control.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kitty/remote_control.py b/kitty/remote_control.py index 81970bb81..9150ada06 100644 --- a/kitty/remote_control.py +++ b/kitty/remote_control.py @@ -408,7 +408,8 @@ def get_password(opts: RCOptions) -> str: except OSError: pass else: - os.dup2(tty_fd, sys.stdin.fileno()) + with open(tty_fd, closefd=True): + os.dup2(tty_fd, sys.stdin.fileno()) else: try: with open(resolve_custom_file(opts.password_file)) as f: