fix: wait for native repair project shell and ignore known input indicators
This commit is contained in:
1 parent
b90a9bbfab
commit
877e3b4c76
4 files changed
+156
-2
No files matched your search
@@ -34,6 +34,8 @@ def repair_completed(diagnostic_text, database_text, *, native_backup):
|
||||
def classify_repair_evidence(diagnostic, database, restore, output):
|
||||
"""Classify this invocation only; an error alone does not prove native idle."""
|
||||
combined = '\n'.join((diagnostic, database, restore, output))
|
||||
# This observed loading-progress line precedes the actual ownership verdict.
|
||||
combined = re.sub(r'(?im)^\s*(?:\[[^\]\r\n]+\]\s*)?Checking if project is in use\.\s*$', '', combined)
|
||||
terminal_error = bool(re.search(r'Repair project error\s*\[[^\r\n]+\]', output, re.I))
|
||||
closed_error = ('Diagnostic: FINISH' in diagnostic and 'IC: Closing project' in database)
|
||||
if re.search(r'project is in use|database.*(?:in use|busy)|other clients are connected', combined, re.I):
|
||||
@@ -225,12 +227,20 @@ def repair_worker_main(job_path):
|
||||
output_baseline = None
|
||||
output = ''
|
||||
while process.poll() is None and time.monotonic()<deadline:
|
||||
windows = _windows(process.pid)
|
||||
windows = [w for w in _windows(process.pid) if not (
|
||||
w['title'] == '' and w['class'] in (
|
||||
'UAC_InputIndicatorOverlayWnd', 'UAC Input Indicator'))]
|
||||
mains = [w for w in windows if w['class'].startswith('Afx:')
|
||||
and w['title'].casefold() == ('iCDB Project Backup - '+str(project)).casefold()]
|
||||
main = mains[0] if len(mains) == 1 else None
|
||||
# The native Afx shell appears before it loads the requested PRJ.
|
||||
# Only a unique, exact generic shell before Repair may wait here;
|
||||
# it never authorizes a command or masks another target/window.
|
||||
shells = [w for w in windows if not invoked and w['class'].startswith('Afx:')
|
||||
and w['title'] == 'iCDB Project Backup']
|
||||
starting = shells[0] if len(shells) == 1 and not mains else None
|
||||
dialogs = [w for w in windows if w['class'] == '#32770']
|
||||
unknown = [w for w in windows if w is not main and w not in dialogs]
|
||||
unknown = [w for w in windows if w is not main and w is not starting and w not in dialogs]
|
||||
current_output = _native_output(windows)
|
||||
busy_before_start = (not invoked and current_output is not None
|
||||
and classify_repair_evidence('', '', '', current_output)['outcome'] == 'DATABASE_BUSY')
|
||||
|
||||
Reference in new issue
Block a user