()
| 49 | const pidFile = path.join(artifactsRoot, '.server.pid'); |
| 50 | |
| 51 | function killExistingServer() { |
| 52 | if (!fs.existsSync(pidFile)) { |
| 53 | return; |
| 54 | } |
| 55 | |
| 56 | try { |
| 57 | const pid = Number(fs.readFileSync(pidFile, 'utf8').trim()); |
| 58 | if (pid > 0) { |
| 59 | process.kill(pid, 'SIGTERM'); |
| 60 | } |
| 61 | } catch { |
| 62 | // ignore stale pid |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | function runPrepareScript() { |
| 67 | const prepareScript = path.join( |