()
| 32 | const pidFile = path.join(projectRoot, '.e2e-artifacts/.server.pid'); |
| 33 | |
| 34 | function stopServer() { |
| 35 | if (!fs.existsSync(pidFile)) { |
| 36 | return; |
| 37 | } |
| 38 | |
| 39 | try { |
| 40 | const pid = Number(fs.readFileSync(pidFile, 'utf8').trim()); |
| 41 | if (pid > 0) { |
| 42 | process.kill(pid, 'SIGTERM'); |
| 43 | } |
| 44 | } catch { |
| 45 | // ignore stale pid |
| 46 | } |
| 47 | |
| 48 | fs.rmSync(pidFile, { force: true }); |
| 49 | } |
| 50 | |
| 51 | async function globalTeardown() { |
| 52 | try { |