fix: hand off late cancelled startup cleanup once

This commit is contained in:
阿白叔 committed 2026-11-17 13:13:24 +08:00
1 parent 906cfc06be
commit 5e9509e573
5 files changed
+256 -7

No files matched your search

+2
View File
@@ -10,6 +10,7 @@ from test_cancelled_loaded_startup import loaded_fixture
def registered_fixture(tmp_path,monkeypatch,*,closed=False,obstacle=''):
import win32con,win32event
kernel_wait=win32event.WaitForSingleObject
job,records,messages,state=loaded_fixture(tmp_path,monkeypatch)
state.update(tip=False,closing=closed)
state['observer_requests']=[]
@@ -52,6 +53,7 @@ def registered_fixture(tmp_path,monkeypatch,*,closed=False,obstacle=''):
monkeypatch.setattr(sessions,'_handle_identity',lambda handle:{k:v for k,v in (worker if handle==11 else identity).items() if k in ('created_handle','image')})
monkeypatch.setattr(sessions,'_force_ownership',lambda h,p:{'owner_sid':'current','session_id':1,'force_user_confirmed':True})
def wait(handle,ms):
if handle not in (11,12):return kernel_wait(handle,ms)
state['ticks']+=ms/1000
return win32con.WAIT_OBJECT_0 if handle==11 and obstacle!='live_worker' or handle==12 and not records else win32con.WAIT_TIMEOUT
monkeypatch.setattr(win32event,'WaitForSingleObject',wait)