🐛 fix: lambda closure crash + .bat version noise on Windows

Bug 1 — UartMonitorWindow crash on serial open failure:
- lambda: self._show_unavailable(str(e))  →  lambda e=e: ...
- Python 3 deletes 'e' after except block; default arg captures it

Bug 2 — xsct version shows 'ECHO 处于关闭状态。' on Windows:
- .bat wrappers output 'ECHO is off' / 'ECHO 处于关闭状态。' noise
- _is_batch_noise() filters known patterns (EN+ZH)
- Version regex now scans all output lines, skipping noise lines
- Path-based fallback (2023.2) catches any remaining undetectable cases
This commit is contained in:
2026-06-11 15:18:08 +08:00
parent 70c88815cc
commit da94cc6cdc
2 changed files with 29 additions and 10 deletions
+1 -1
View File
@@ -1079,7 +1079,7 @@ class UartMonitorWindow(ctk.CTkToplevel):
ser.close()
self.after(0, self._on_open_success)
except Exception as e:
self.after(0, lambda: self._show_unavailable(str(e)))
self.after(0, lambda e=e: self._show_unavailable(str(e)))
threading.Thread(target=_bg_open, daemon=True).start()