Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(desktop): skip WSL distro probing while the WSL backend is off #21225

Mergedonly21mil(GitHub profile, opens in a new tab)merged 5 commits intomain fromrefs/pull/21225/headmerged by juliusmarminge View on GitHub

Showing 3 changed files with 50 additions and 6 deletions.

x
0 of 3 viewed, 3 left
37 additions and 0 deletionsapps/desktop/src/ipc/methods/wsl.test.tsModified
View file
@@ -120,6 +120,43 @@
​
+ it.effect("does not enumerate distros until the WSL backend is enabled", () => {
+ const distros = [
+ { name: "Ubuntu", isDefault: true, version: 2 as const },
+ { name: "Debian", isDefault: false, version: 2 as const },
+ ];
+ const layer = Layer.mergeAll(
+ DesktopAppSettings.layerTest({
+ ...DesktopAppSettings.DEFAULT_DESKTOP_SETTINGS,
+ wslDistro: "Debian",
+ }),
+ DesktopWslEnvironment.layerTest({ isAvailable: true, distros }),
+ layerWslBackend(),
+ layerLifecycle([]),
+ layerUnusedLifecycleRuntime,
+ );
+​
+ return Effect.gen(function* () {
+ const wsl = yield* DesktopWslEnvironment.DesktopWslEnvironment;
+ const state = yield* getWslState.handler(undefined).pipe(
+ Effect.provideService(DesktopWslEnvironment.DesktopWslEnvironment, {
+ ...wsl,
+ listDistros: Effect.die("must not enumerate distros"),
+ }),
+ Effect.flatMap(decodeWslState),
+ );
+ assert.equal(state.enabled, false);