it("prefers symlinked path over realpath for stable service config", async () => { // Simulates pnpm global install where node_modules/openclaw is a symlink // to .pnpm/openclaw@X.Y.Z/node_modules/openclaw const symlinkPath = path.resolve( "/Users/test/Library/pnpm/global/5/node_modules/openclaw/dist/entry.js",
); const realpathResolved = path.resolve( "/Users/test/Library/pnpm/global/5/node_modules/.pnpm/openclaw@2026.1.21-2/node_modules/openclaw/dist/entry.js",
);
process.argv = ["node", symlinkPath];
fsMocks.realpath.mockResolvedValue(realpathResolved);
fsMocks.access.mockResolvedValue(undefined); // Both paths exist
const result = await resolveGatewayProgramArguments({ port: 18789 });
// Should use the symlinked canonical index.js path, not the realpath-resolved versioned path
expect(result.programArguments[1]).toBe(
path.resolve("/Users/test/Library/pnpm/global/5/node_modules/openclaw/dist/index.js"),
);
expect(result.programArguments[1]).not.toContain("@2026.1.21-2");
});
it("falls back to node_modules package dist when .bin path is not resolved", async () => { const argv1 = path.resolve("/tmp/.npm/_npx/63c3/node_modules/.bin/openclaw"); const indexPath = path.resolve("/tmp/.npm/_npx/63c3/node_modules/openclaw/dist/index.js");
process.argv = ["node", argv1];
fsMocks.realpath.mockRejectedValue(new Error("no realpath"));
fsMocks.access.mockImplementation(async (target: string) => { if (target === indexPath) { return;
} thrownew Error("missing");
});
const result = await resolveGatewayProgramArguments({ port: 18789 });
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.