fix: improve WSL2 systemd daemon hints
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user