From 9b7e387ea6cd3742f399f60145c8f5bea2f06d03 Mon Sep 17 00:00:00 2001 From: Jimmy Date: Sun, 3 May 2026 14:56:34 +1200 Subject: [PATCH] chore(scripts): add dev-run helper Co-authored-by: Cursor --- scripts/dev-run.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 scripts/dev-run.sh diff --git a/scripts/dev-run.sh b/scripts/dev-run.sh new file mode 100644 index 0000000..8d183bc --- /dev/null +++ b/scripts/dev-run.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +set -euo pipefail + +ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)" +PORT="${PORT:-80}" + +# On watchfiles restarts the previous process can linger briefly. +# Proactively terminate any listener on the target port before boot. +pids="$(ss -ltnp "sport = :$PORT" 2>/dev/null | sed -n 's/.*pid=\([0-9]\+\).*/\1/p' | sort -u)" +if [ -n "${pids}" ]; then + kill -TERM ${pids} 2>/dev/null || true + sleep 0.3 +fi + +cd "$ROOT_DIR/src" +exec python main.py