mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 09:41:24 +00:00
fix: tighten gateway restart loop handling (#23416) (thanks @jeffwnli)
This commit is contained in:
@@ -56,6 +56,17 @@ describe("infra parsing", () => {
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
it("returns true for dist/entry.js when launched via openclaw.mjs wrapper", () => {
|
||||
expect(
|
||||
isMainModule({
|
||||
currentFile: "/repo/dist/entry.js",
|
||||
argv: ["node", "/repo/openclaw.mjs"],
|
||||
cwd: "/repo",
|
||||
env: {},
|
||||
}),
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
it("returns false when running under PM2 but this module is imported", () => {
|
||||
expect(
|
||||
isMainModule({
|
||||
|
||||
@@ -41,6 +41,16 @@ export function isMainModule({
|
||||
return true;
|
||||
}
|
||||
|
||||
// The published/open-source wrapper binary is openclaw.mjs, which then imports
|
||||
// dist/entry.js. Treat that pair as the main module so entry bootstrap runs.
|
||||
if (normalizedCurrent && normalizedArgv1) {
|
||||
const currentBase = path.basename(normalizedCurrent);
|
||||
const argvBase = path.basename(normalizedArgv1);
|
||||
if (currentBase === "entry.js" && (argvBase === "openclaw.mjs" || argvBase === "openclaw.js")) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Fallback: basename match (relative paths, symlinked bins).
|
||||
if (
|
||||
normalizedCurrent &&
|
||||
|
||||
Reference in New Issue
Block a user