You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
708 B
25 lines
708 B
import { readFileSync, existsSync, unlinkSync } from "node:fs";
|
|
import path from "node:path";
|
|
|
|
const ROOT = path.resolve(import.meta.dirname, "..");
|
|
const PID_FILE = path.join(ROOT, ".e2e-server-pid");
|
|
|
|
async function main() {
|
|
if (existsSync(PID_FILE)) {
|
|
const pid = parseInt(readFileSync(PID_FILE, "utf-8").trim(), 10);
|
|
if (pid) {
|
|
try {
|
|
process.kill(pid, "SIGTERM");
|
|
console.log(`[global-teardown] Stopped server (PID: ${pid})`);
|
|
} catch {
|
|
// 进程可能已退出
|
|
}
|
|
}
|
|
unlinkSync(PID_FILE);
|
|
}
|
|
|
|
// mock LLM 服务器在 global-setup 进程中运行,进程退出时自动关闭
|
|
console.log("[global-teardown] Done");
|
|
}
|
|
|
|
export default main;
|
|
|