INNER CODE UNIT · TypeScript
flushOnce
HoangNguyen0403/agent-skills-standard · mcp/src/index.ts:30
const flushOnce = () => {
if (flushed) return;
flushed = true;
writer.flush(
buildTelemetryRecord(tracker, {
mcpVersion: SERVER_VERSION,
}),
);
};
process.on("exit", flushOnce);
for (const signal of ["SIGINT", "SIGTERM"] as const) {
process.once(signal, () => {
flushOnce();
process.exit(signal === "SIGINT" ? 130 : 143);
});
}
// Log to stderr — stdout is reserved for MCP JSON-RPC frames in stdio mode.