fix: improve WSL2 systemd daemon hints

This commit is contained in:
Peter Steinberger
2026-01-17 18:19:47 +00:00
parent 408f4f2dac
commit 8a67d29748
10 changed files with 110 additions and 36 deletions

View File

@@ -13,6 +13,7 @@ import { callGateway } from "../gateway/call.js";
import { normalizeControlUiBasePath } from "../gateway/control-ui.js";
import { isSafeExecutableValue } from "../infra/exec-safety.js";
import { pickPrimaryTailnetIPv4 } from "../infra/tailnet.js";
import { isWSL } from "../infra/wsl.js";
import { runCommandWithTimeout } from "../process/exec.js";
import type { RuntimeEnv } from "../runtime.js";
import { stylePromptTitle } from "../terminal/prompt-style.js";
@@ -91,27 +92,6 @@ type BrowserOpenSupport = {
command?: string;
};
let wslCached: boolean | null = null;
async function isWSL(): Promise<boolean> {
if (wslCached !== null) return wslCached;
if (process.platform !== "linux") {
wslCached = false;
return wslCached;
}
if (process.env.WSL_INTEROP || process.env.WSL_DISTRO_NAME || process.env.WSLENV) {
wslCached = true;
return wslCached;
}
try {
const release = (await fs.readFile("/proc/version", "utf8")).toLowerCase();
wslCached = release.includes("microsoft") || release.includes("wsl");
} catch {
wslCached = false;
}
return wslCached;
}
type BrowserOpenCommand = {
argv: string[] | null;
reason?: string;