Update on auto setup
This commit is contained in:
@@ -1,9 +1,16 @@
|
||||
// ── Port Precheck ──────────────────────────────────────────────────
|
||||
// Kills any existing processes on ports 3001, 3006, 3007, 3008.
|
||||
// These are the AI server, Next.js frontend, Signaling server, and
|
||||
// Python scraper respectively.
|
||||
// Runs before anything else starts to avoid EADDRINUSE errors.
|
||||
|
||||
import { execSync } from "node:child_process"
|
||||
import { platform } from "node:os"
|
||||
|
||||
const PORTS = [3001, 3006, 3007, 3008]
|
||||
|
||||
if (platform() === "win32") {
|
||||
// Windows: use netstat + findstr to find listening PIDs, then taskkill
|
||||
for (const port of PORTS) {
|
||||
try {
|
||||
const out = execSync(`netstat -ano | findstr "LISTENING" | findstr ":${port} "`, { encoding: "utf8", timeout: 5000 })
|
||||
@@ -18,6 +25,7 @@ if (platform() === "win32") {
|
||||
} catch {}
|
||||
}
|
||||
} else {
|
||||
// Linux/Mac: use lsof -ti to find PIDs, then kill -9
|
||||
for (const port of PORTS) {
|
||||
try {
|
||||
const pid = execSync(`lsof -ti:${port} 2>/dev/null`, { encoding: "utf8", timeout: 5000 }).trim()
|
||||
|
||||
Reference in New Issue
Block a user