(port: number)
| 16 | } |
| 17 | |
| 18 | function killProcessOnPort(port: number): void { |
| 19 | try { |
| 20 | const output = execSync(`lsof -ti tcp:${port} 2>/dev/null || true`) |
| 21 | .toString() |
| 22 | .trim(); |
| 23 | if (output) { |
| 24 | for (const pid of output.split("\n").filter(Boolean)) { |
| 25 | try { |
| 26 | process.kill(Number(pid), "SIGKILL"); |
| 27 | } catch { |
| 28 | // already dead |
| 29 | } |
| 30 | } |
| 31 | } |
| 32 | } catch { |
| 33 | // ignore |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | function startWrangler(): ChildProcess { |
| 38 | const configPath = path.join(__dirname, "wrangler.jsonc"); |