Only write to the OpenSSH version sentinel file once

This commit is contained in:
pagedown 2022-03-17 22:23:48 +08:00
parent 1e84cbe2ab
commit 1962519666
No known key found for this signature in database
GPG Key ID: E921CF18AC8FF6EB

View File

@ -602,7 +602,9 @@ def run_ssh(ssh_args: List[str], server_args: List[str], found_extra_args: Tuple
need_to_request_data = True need_to_request_data = True
if use_kitty_askpass: if use_kitty_askpass:
sentinel = os.path.join(cache_dir(), 'openssh-is-new-enough-for-askpass') sentinel = os.path.join(cache_dir(), 'openssh-is-new-enough-for-askpass')
if os.path.exists(sentinel) or ssh_version() >= (8, 4): sentinel_exists = os.path.exists(sentinel)
if sentinel_exists or ssh_version() >= (8, 4):
if not sentinel_exists:
open(sentinel, 'w').close() open(sentinel, 'w').close()
# SSH_ASKPASS_REQUIRE was introduced in 8.4 release on 2020-09-27 # SSH_ASKPASS_REQUIRE was introduced in 8.4 release on 2020-09-27
need_to_request_data = False need_to_request_data = False