fix(concurrency): serialize Win32 clipboard access and test env vars to prevent STATUS_HEAP_CORRUPTION

This commit is contained in:
Riz Ashraf committed 2026-10-07 22:30:36 +01:00
1 parent 35c802c1b8
commit 64857f9d5e
2 files changed
+13 -1

No files matched your search

+8 -1
View File
@@ -332,7 +332,10 @@ pub async fn run_server(state: Arc<MemoryState>) -> Result<(), Box<dyn std::erro
}
let (tech_debts, adrs) = if let Some(ref f) = payload.file {
crate::api::telemetry::find_projected_knowledge(&nvim_udp_state.handler.state, f)
crate::api::telemetry::find_projected_knowledge(
&nvim_udp_state.handler.state,
f,
)
} else {
(Vec::new(), Vec::new())
};
@@ -678,8 +681,11 @@ mod tests {
}
}
static ENV_LOCK: std::sync::Mutex<()> = std::sync::Mutex::new(());
#[test]
fn test_init_logging_helper() {
let _lock = ENV_LOCK.lock().unwrap_or_else(|e| e.into_inner());
let temp_dir = tempfile::tempdir().unwrap();
unsafe {
std::env::set_var("MCP_MEMORY_STORE_DIR", temp_dir.path().to_str().unwrap());
@@ -711,6 +717,7 @@ mod tests {
#[tokio::test]
async fn test_run_server_graceful_shutdown() {
let _lock = ENV_LOCK.lock().unwrap_or_else(|e| e.into_inner());
let temp_dir = tempfile::tempdir().unwrap();
let state = Arc::new(MemoryState::new(temp_dir.path().to_str().unwrap()));