@@ -298,7 +298,7 @@ describe("respawnGatewayProcessForUpdate", () => {
|
298 | 298 | process.execArgv = []; |
299 | 299 | process.argv = [ |
300 | 300 | "C:\\Program Files\\node.exe", |
301 | | -"C:\\openclaw\\dist\\index.js", |
| 301 | +"C:\\openclaw\\node_modules\\.pnpm\\openclaw@2026.6.5\\node_modules\\openclaw\\dist\\index.js", |
302 | 302 | "gateway", |
303 | 303 | "run", |
304 | 304 | ]; |
@@ -310,7 +310,7 @@ describe("respawnGatewayProcessForUpdate", () => {
|
310 | 310 | expect(result.pid).toBe(5151); |
311 | 311 | expect(spawnMock).toHaveBeenCalledWith( |
312 | 312 | process.execPath, |
313 | | -["C:\\openclaw\\dist\\index.js", "gateway", "run"], |
| 313 | +["C:\\openclaw\\node_modules\\openclaw\\openclaw.mjs", "gateway", "run"], |
314 | 314 | { |
315 | 315 | detached: true, |
316 | 316 | env: process.env, |
@@ -319,6 +319,50 @@ describe("respawnGatewayProcessForUpdate", () => {
|
319 | 319 | ); |
320 | 320 | }); |
321 | 321 | |
| 322 | +it("rewrites a pnpm-versioned OpenClaw entry before detached update respawn", () => { |
| 323 | +clearSupervisorHints(); |
| 324 | +setPlatform("linux"); |
| 325 | +process.execArgv = []; |
| 326 | +process.argv = [ |
| 327 | +"/usr/local/bin/node", |
| 328 | +"/app/node_modules/.pnpm/openclaw@2026.6.5/node_modules/openclaw/dist/entry.js", |
| 329 | +"gateway", |
| 330 | +"run", |
| 331 | +]; |
| 332 | +spawnMock.mockReturnValue({ pid: 7171, unref: vi.fn(), kill: vi.fn() }); |
| 333 | + |
| 334 | +const result = respawnGatewayProcessForUpdate(); |
| 335 | + |
| 336 | +expect(result.mode).toBe("spawned"); |
| 337 | +expect(spawnMock).toHaveBeenCalledWith( |
| 338 | +process.execPath, |
| 339 | +["/app/node_modules/openclaw/openclaw.mjs", "gateway", "run"], |
| 340 | +{ |
| 341 | +detached: true, |
| 342 | +env: process.env, |
| 343 | +stdio: "inherit", |
| 344 | +}, |
| 345 | +); |
| 346 | +}); |
| 347 | + |
| 348 | +it("does not rewrite another package's pnpm-versioned entry", () => { |
| 349 | +clearSupervisorHints(); |
| 350 | +setPlatform("linux"); |
| 351 | +process.execArgv = []; |
| 352 | +const entry = |
| 353 | +"/app/node_modules/.pnpm/@anthropic+sdk@1.0.0/node_modules/@anthropic/sdk/dist/index.js"; |
| 354 | +process.argv = ["/usr/local/bin/node", entry, "gateway", "run"]; |
| 355 | +spawnMock.mockReturnValue({ pid: 8181, unref: vi.fn(), kill: vi.fn() }); |
| 356 | + |
| 357 | +respawnGatewayProcessForUpdate(); |
| 358 | + |
| 359 | +expect(spawnMock).toHaveBeenCalledWith(process.execPath, [entry, "gateway", "run"], { |
| 360 | +detached: true, |
| 361 | +env: process.env, |
| 362 | +stdio: "inherit", |
| 363 | +}); |
| 364 | +}); |
| 365 | + |
322 | 366 | it("spawns a detached update process when macOS only has inherited XPC state", () => { |
323 | 367 | clearSupervisorHints(); |
324 | 368 | setPlatform("darwin"); |
|