mirror of
https://github.com/leonvanzyl/autocoder.git
synced 2026-01-30 06:12:06 +00:00
fix: Address Leon's review - safer process killing and cross-platform support
Changes:
- Replace pkill -f "node" with port-based killing (lsof -ti :PORT)
- Safer: only kills dev server, not VS Code/Claude Code/other Node apps
- More specific: targets exact port instead of all Node processes
- Add Windows alternative commands (commented, for reference)
- Use ${PORT:-3000} variable instead of hardcoded port 3000
- Update health check and API verification to use PORT variable
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -217,14 +217,20 @@ grep -r "new Map\(\)\|new Set\(\)" --include="*.ts" --include="*.tsx" --include=
|
|||||||
|
|
||||||
3. **STOP the server completely:**
|
3. **STOP the server completely:**
|
||||||
```bash
|
```bash
|
||||||
# Send SIGTERM first, then SIGKILL if needed
|
# Kill by port (safer - only kills the dev server, not VS Code/Claude Code/etc.)
|
||||||
pkill -f "node" || pkill -f "npm" || pkill -f "next"
|
# Unix/macOS:
|
||||||
|
lsof -ti :${PORT:-3000} | xargs kill -TERM 2>/dev/null || true
|
||||||
sleep 3
|
sleep 3
|
||||||
pkill -9 -f "node" 2>/dev/null || true
|
lsof -ti :${PORT:-3000} | xargs kill -9 2>/dev/null || true
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
|
# Windows alternative (use if lsof not available):
|
||||||
|
# netstat -ano | findstr :${PORT:-3000} | findstr LISTENING
|
||||||
|
# taskkill /F /PID <pid_from_above> 2>nul
|
||||||
|
|
||||||
# Verify server is stopped
|
# Verify server is stopped
|
||||||
if pgrep -f "node" > /dev/null; then
|
if lsof -ti :${PORT:-3000} > /dev/null 2>&1; then
|
||||||
echo "ERROR: Server still running!"
|
echo "ERROR: Server still running on port ${PORT:-3000}!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
```
|
```
|
||||||
@@ -234,7 +240,7 @@ grep -r "new Map\(\)\|new Set\(\)" --include="*.ts" --include="*.tsx" --include=
|
|||||||
./init.sh &
|
./init.sh &
|
||||||
sleep 15 # Allow server to fully start
|
sleep 15 # Allow server to fully start
|
||||||
# Verify server is responding
|
# Verify server is responding
|
||||||
if ! curl -f http://localhost:3000/api/health && ! curl -f http://localhost:3000; then
|
if ! curl -f http://localhost:${PORT:-3000}/api/health && ! curl -f http://localhost:${PORT:-3000}; then
|
||||||
echo "ERROR: Server failed to start after restart"
|
echo "ERROR: Server failed to start after restart"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@@ -242,7 +248,7 @@ grep -r "new Map\(\)\|new Set\(\)" --include="*.ts" --include="*.tsx" --include=
|
|||||||
|
|
||||||
5. **Query for test data - it MUST still exist**
|
5. **Query for test data - it MUST still exist**
|
||||||
- Via UI: Navigate to data location, verify data appears
|
- Via UI: Navigate to data location, verify data appears
|
||||||
- Via API: `curl http://localhost:PORT/api/items` - verify data in response
|
- Via API: `curl http://localhost:${PORT:-3000}/api/items` - verify data in response
|
||||||
|
|
||||||
6. **If data is GONE:** Implementation uses in-memory storage → CRITICAL FAIL
|
6. **If data is GONE:** Implementation uses in-memory storage → CRITICAL FAIL
|
||||||
- Run all grep commands from STEP 5.6 to identify the mock pattern
|
- Run all grep commands from STEP 5.6 to identify the mock pattern
|
||||||
|
|||||||
Reference in New Issue
Block a user