From b86dd3b07d6655548f18c46990b55b314970321f Mon Sep 17 00:00:00 2001 From: saphid <4596216+saphid@users.noreply.github.com> Date: Sat, 26 Sep 2026 23:06:13 +1000 Subject: [PATCH] Interrupt stalled downloads on Windows too shutdown() from another thread doesn't wake a blocked recv on Windows, so quitting mid-download waited out the 4 s deadline there (CI's Windows server tests). Close the handle as well, detached first so the worker's own close can't hit a reused handle. Co-Authored-By: Claude Opus 5.5 (1M context) --- ui/frame_webinstall.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ui/frame_webinstall.py b/ui/frame_webinstall.py index 2f2e006..43b1723 100644 --- a/ui/frame_webinstall.py +++ b/ui/frame_webinstall.py @@ -373,6 +373,14 @@ def abort(conn): sock.shutdown(socket.SHUT_RDWR) except OSError: pass + if os.name == "nt": + # Windows doesn't wake a recv blocked in another thread on shutdown(), + # only when the handle closes. detach() first, so the owner's later + # close() can't close a handle the OS has since given to someone else. + try: + socket.close(sock.detach()) + except OSError: + pass def download(p, dest_dir, progress=None, cancelled=None, connected=None):