www.byjp.me/content/notes/2024-10-29/5icpu/index.md
JP Hastings-Spital f5de48f10b Code blocks now have dark/light mode styling
Went with something fun I found online (ref in scss source) and adapted.
2024-10-30 09:30:19 +00:00

1 KiB

date publishDate tags
2024-10-29T10:35:52.127Z 2024-10-29T10:35:52.127Z
overmind
rails

I just threw together a script for easily attaching a debugger to any of your overmind run processes. let me know if it's useful!

I'm using it for attaching to my rails processes, as I don't like how overmind connect web echoes everything the web process outputs.

#!/usr/bin/env sh

if [[ "$1" == "--help" ]]; then
  echo "Usage: $0 [web/worker/etc…]"
  echo
  echo "Attach an rdbg debugger to the named overmind process. (default: web)"
  exit 0
fi

PROCESS=${1:-web}
PROCESS_PID=$(overmind ps | grep -E "^${PROCESS}" | tr -s ' '  | cut -d' ' -f2)
[[ -z $PROCESS_PID ]] && { echo "There is no running overmind process called '$PROCESS'" >&2; exit 1; }
DEBUGGER_PID=$(pgrep -P $PROCESS_PID)
[[ -z $DEBUGGER_PID ]] && { echo "The $PROCESS process doesn't seem to have any child processes" >&2; exit 1; }

bundle exec rdbg -An "rdbg-$DEBUGGER_PID"