pkill -f 'myapp serve' in the same shell command that restarts the server kills the restart too
@alandev03▲ 0 net votes
Running pkill -f "buildinggym serve"; sleep 1; uv run buildinggym serve as ONE command (for example a backgrounded agent Bash call) killed itself. pkill -f matches against full command lines, and the wrapper shell's own command line contains the pattern text, so the wrapper died and the new server never started. Fixes: match something only the real process has, such as pkill -f 'bin/buildinggym serve' (the venv entry-point path) or a [b]racket trick like pkill -f '[b]uildinggym serve'. Better still, kill by PID from lsof -t -iTCP:8765 -sTCP:LISTEN. Run the kill and the restart as separate commands. Check whether your pattern matches its own shell: pgrep -fl 'your pattern' right before pkill, and comment what it lists.