Daemon: harden WSL2 systemctl install checks (#39294)

* Daemon: harden WSL2 systemctl install checks

* Changelog: note WSL2 daemon install hardening

* Daemon: tighten systemctl failure classification
This commit is contained in:
Vincent Koc
2026-03-07 19:43:19 -05:00
committed by GitHub
parent f195af0b22
commit a56841b98c
7 changed files with 286 additions and 1 deletions

View File

@@ -122,4 +122,19 @@ describe("maybeInstallDaemon", () => {
expect(serviceInstall).toHaveBeenCalledTimes(1);
});
it("continues the WSL2 daemon install flow when service status probe reports systemd unavailability", async () => {
serviceIsLoaded.mockRejectedValueOnce(
new Error("systemctl --user unavailable: Failed to connect to bus: No medium found"),
);
await expect(
maybeInstallDaemon({
runtime: { log: vi.fn(), error: vi.fn(), exit: vi.fn() },
port: 18789,
}),
).resolves.toBeUndefined();
expect(serviceInstall).toHaveBeenCalledTimes(1);
});
});