Compare commits

...
Author SHA1 Message Date
l0ng-ai 0b0586a71a fix(windows): don't show system error boxes for processes that fail to load
A broken python.exe found while detecting interpreters made Windows show a
modal "System Error" box ("VCRUNTIME140.dll was not found"). The app now
sets SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX at startup; child
processes inherit the error mode, so such a probe fails with an exit code.

Fixes #1161
2026-11-10 23:28:53 +08:00
2 changed files with 16 additions and 0 deletions

No files matched your search

+1
View File
@@ -107,6 +107,7 @@ windows = { version = "0.62", features = [
windows-sys = { version = "0.61", features = [
"Win32_Foundation",
"Win32_Graphics_Gdi",
"Win32_System_Diagnostics_Debug",
"Win32_UI_Shell",
"Win32_UI_WindowsAndMessaging",
] }
+15
View File
@@ -71,6 +71,8 @@ pub fn export_bindings(builder: &tauri_specta::Builder<tauri::Wry>) {
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
ide_workspace::process::mark_start();
#[cfg(windows)]
quiet_error_dialogs();
let context = tauri::generate_context!();
#[cfg(debug_assertions)]
let context = dev::configure(context);
@@ -389,3 +391,16 @@ pub(crate) fn dispatch_menu_action(app: &tauri::AppHandle, id: &str) {
},
}
}
/// Windows shows a modal "System Error" box when a process can't load a DLL (a broken
/// `python.exe` found while detecting interpreters: "VCRUNTIME140.dll was not found").
/// Child processes inherit the error mode, so probes and tools started by the IDE fail
/// with an exit code instead (#1161).
#[cfg(windows)]
fn quiet_error_dialogs() {
use windows_sys::Win32::System::Diagnostics::Debug::{
SEM_FAILCRITICALERRORS, SEM_NOOPENFILEERRORBOX, SetErrorMode,
};
// SAFETY: SetErrorMode only changes this process's error mode flags.
unsafe { SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX) };
}