mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 01:20:22 +00:00
Daemon: scope relaxed systemd probes to install flows
This commit is contained in:
@@ -123,6 +123,21 @@ describe("maybeInstallDaemon", () => {
|
||||
expect(serviceInstall).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it("rethrows install probe failures that are not the known non-fatal Linux systemd cases", async () => {
|
||||
serviceIsLoaded.mockRejectedValueOnce(
|
||||
new Error("systemctl is-enabled unavailable: read-only file system"),
|
||||
);
|
||||
|
||||
await expect(
|
||||
maybeInstallDaemon({
|
||||
runtime: { log: vi.fn(), error: vi.fn(), exit: vi.fn() },
|
||||
port: 18789,
|
||||
}),
|
||||
).rejects.toThrow("systemctl is-enabled unavailable: read-only file system");
|
||||
|
||||
expect(serviceInstall).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
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"),
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { withProgress } from "../cli/progress.js";
|
||||
import { loadConfig } from "../config/config.js";
|
||||
import { resolveGatewayService } from "../daemon/service.js";
|
||||
import { isNonFatalSystemdInstallProbeError } from "../daemon/systemd.js";
|
||||
import type { RuntimeEnv } from "../runtime.js";
|
||||
import { note } from "../terminal/note.js";
|
||||
import { confirm, select } from "./configure.shared.js";
|
||||
@@ -23,7 +24,10 @@ export async function maybeInstallDaemon(params: {
|
||||
let loaded = false;
|
||||
try {
|
||||
loaded = await service.isLoaded({ env: process.env });
|
||||
} catch {
|
||||
} catch (error) {
|
||||
if (!isNonFatalSystemdInstallProbeError(error)) {
|
||||
throw error;
|
||||
}
|
||||
loaded = false;
|
||||
}
|
||||
let shouldCheckLinger = false;
|
||||
|
||||
Reference in New Issue
Block a user