committed by
Peter Steinberger
parent
6bcb89cf38
commit
d9f2ee40f7
19
test/fixtures/signal-forwarding/child.ts
vendored
Normal file
19
test/fixtures/signal-forwarding/child.ts
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
import http from "node:http";
|
||||
|
||||
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 shutdown = (): void => {
|
||||
server.close(() => process.exit(0));
|
||||
};
|
||||
|
||||
process.on("SIGTERM", shutdown);
|
||||
process.on("SIGINT", shutdown);
|
||||
Reference in New Issue
Block a user