From cfa04e1188484b9315c81d70a437b169d5bc5670 Mon Sep 17 00:00:00 2001 From: centdix Date: Sun, 22 Feb 2026 13:42:46 +0000 Subject: [PATCH] kill process on clenaup --- scripts/worktree-cleanup | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/scripts/worktree-cleanup b/scripts/worktree-cleanup index f4337f8b97..ca1c098c6d 100755 --- a/scripts/worktree-cleanup +++ b/scripts/worktree-cleanup @@ -1,6 +1,19 @@ #!/usr/bin/env bash set -euo pipefail +# Kill backend/frontend processes using this worktree's ports +if [ -f .env.local ]; then + source .env.local + for port in "${BACKEND_PORT:-}" "${FRONTEND_PORT:-}"; do + [ -z "$port" ] && continue + pid=$(lsof -ti "TCP:${port}" -sTCP:LISTEN 2>/dev/null || true) + if [ -n "$pid" ]; then + kill "$pid" 2>/dev/null && echo "Killed process $pid on port $port" \ + || echo "Warning: Could not kill process $pid on port $port" + fi + done +fi + # Remove the matching windmill-ee-private worktree if one exists wt_basename=$(basename "$(pwd)")