mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-12 07:20:45 +00:00
perf(test): speed up suites and reduce fs churn
This commit is contained in:
18
test/fixtures/child-process-bridge/child.js
vendored
18
test/fixtures/child-process-bridge/child.js
vendored
@@ -1,20 +1,10 @@
|
||||
import http from "node:http";
|
||||
process.stdout.write("ready\n");
|
||||
|
||||
const server = http.createServer((_, res) => {
|
||||
res.writeHead(200, { "content-type": "text/plain" });
|
||||
res.end("ok");
|
||||
});
|
||||
|
||||
server.listen(0, "127.0.0.1", () => {
|
||||
const addr = server.address();
|
||||
if (!addr || typeof addr === "string") {
|
||||
throw new Error("unexpected address");
|
||||
}
|
||||
process.stdout.write(`${addr.port}\n`);
|
||||
});
|
||||
const keepAlive = setInterval(() => {}, 1000);
|
||||
|
||||
const shutdown = () => {
|
||||
server.close(() => process.exit(0));
|
||||
clearInterval(keepAlive);
|
||||
process.exit(0);
|
||||
};
|
||||
|
||||
process.on("SIGTERM", shutdown);
|
||||
|
||||
Reference in New Issue
Block a user