Skip to content

Commit 81a10c7

Browse files
committed
fix ctrl+c make dev
1 parent bedf69d commit 81a10c7

1 file changed

Lines changed: 22 additions & 4 deletions

File tree

bin/dev

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,28 @@ export RACK_ENV=${RACK_ENV:-development}
1212

1313
# Cleanup function for graceful shutdown
1414
cleanup() {
15-
kill $RUBY_PID 2>/dev/null || true
16-
kill $ASTRO_PID 2>/dev/null || true
17-
wait $RUBY_PID 2>/dev/null || true
18-
wait $ASTRO_PID 2>/dev/null || true
15+
echo ""
16+
echo "🛑 Shutting down development servers..."
17+
18+
# Kill Ruby server
19+
if [ ! -z "$RUBY_PID" ]; then
20+
kill $RUBY_PID 2>/dev/null || true
21+
wait $RUBY_PID 2>/dev/null || true
22+
fi
23+
24+
# Kill Astro server and its children
25+
if [ ! -z "$ASTRO_PID" ]; then
26+
# Kill the npm process and its children
27+
pkill -P $ASTRO_PID 2>/dev/null || true
28+
kill $ASTRO_PID 2>/dev/null || true
29+
wait $ASTRO_PID 2>/dev/null || true
30+
fi
31+
32+
# Clean up any remaining processes on our ports
33+
pkill -f "puma.*html2rss-web" 2>/dev/null || true
34+
pkill -f "astro.*dev.*3001" 2>/dev/null || true
35+
36+
echo "✅ Development servers stopped"
1937
exit 0
2038
}
2139

0 commit comments

Comments
 (0)