1// Fixture used by DevCommand.test.ts. Writes its PID + a marker (so the test
2// can tell two consecutive spawns apart) and then sleeps forever. The test
3// uses `process.kill(pid, 0)` to assert liveness from the outside.
4const fs = require("node:fs");
5
6const file = process.env.PID_FILE;
7const marker = process.env.MARKER ?? "default";
8
9if (!file) {
10 console.error("long-running.cjs: PID_FILE env var is required");
11 process.exit(1);
12}
13
14fs.writeFileSync(file, JSON.stringify({ pid: process.pid, marker }));
15
16// Print a localhost URL so the Dev provider's URL-readiness scan resolves
17// immediately (like a real dev server) instead of waiting out its 5-second
18// budget. Tests that use this fixture assert on process lifecycle, not URL
19// extraction — url-server.cjs covers that.
20console.log("http://localhost:65535/");
21
22// Hold the event loop open without doing any actual work.
23setInterval(() => {}, 60_000);