Visual Studio Code, rebuilt in Rust
Rust
fix(test): keep OS watcher threads out of workbench tests (#98)
Artur Rokb2e4305a1c66
diff --git a/native/crates/app/src/workbench/power.rs b/native/crates/app/src/workbench/power.rsindex 7fd2a75e249..5e6972ad255 100644--- a/native/crates/app/src/workbench/power.rs+++ b/native/crates/app/src/workbench/power.rs@@ -28,9 +28,14 @@ impl Workbench {/// Forwards powerMonitor's events to the extension host and watches the network path.pub(super) fn start_system_events(&mut self, cx: &mut Context<Self>) {let (power_events, mut power) = unbounded();- crate::power::watch(power_events);let (path_updates, mut paths) = unbounded();- crate::metered_connection::watch(path_updates);+ let (display_changes, mut display) = unbounded();+ // The GPUI test scheduler panics when a watcher thread sends on or drops its sender, as the Linux ones do without D-Bus.+ if !cfg!(test) {+ crate::power::watch(power_events);+ crate::metered_connection::watch(path_updates);+ crate::power::watch_accessibility_display(display_changes);+ }cx.spawn(async move |workbench, cx| {while let Some((method, args)) = power.next().await {if workbench.update(cx, |workbench, _| workbench.host.send("ExtHostPower", method, args)).is_err() {@@ -51,8 +56,6 @@ impl Workbench {}}).detach();- let (display_changes, mut display) = unbounded();- crate::power::watch_accessibility_display(display_changes);cx.spawn(async move |workbench, cx| {while display.next().await.is_some() {// accessibilityService.ts fires `onDidChangeReducedMotion` for the OS value only while the setting is auto.