mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 09:11:26 +00:00
fix: tighten gateway restart loop handling (#23416) (thanks @jeffwnli)
This commit is contained in:
@@ -31,8 +31,14 @@ describe("isPidAlive", () => {
|
||||
});
|
||||
|
||||
// Override platform to linux so the zombie check runs
|
||||
const originalPlatform = process.platform;
|
||||
Object.defineProperty(process, "platform", { value: "linux", writable: true });
|
||||
const originalPlatformDescriptor = Object.getOwnPropertyDescriptor(process, "platform");
|
||||
if (!originalPlatformDescriptor) {
|
||||
throw new Error("missing process.platform descriptor");
|
||||
}
|
||||
Object.defineProperty(process, "platform", {
|
||||
...originalPlatformDescriptor,
|
||||
value: "linux",
|
||||
});
|
||||
|
||||
try {
|
||||
// Re-import the module so it picks up the mocked platform and fs
|
||||
@@ -40,7 +46,7 @@ describe("isPidAlive", () => {
|
||||
const { isPidAlive: freshIsPidAlive } = await import("./pid-alive.js");
|
||||
expect(freshIsPidAlive(zombiePid)).toBe(false);
|
||||
} finally {
|
||||
Object.defineProperty(process, "platform", { value: originalPlatform, writable: true });
|
||||
Object.defineProperty(process, "platform", originalPlatformDescriptor);
|
||||
vi.restoreAllMocks();
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user