Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion mise-tasks/dev-all
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
# MISE dir is packages/realm-server, so ../.. is repo root
PATH="$(pwd)/../../node_modules/.bin:$(pwd)/node_modules/.bin:$PATH"

. "$(cd "$(dirname "$0")" && pwd)/lib/dev-common.sh"
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"

. "$SCRIPT_DIR/lib/dev-common.sh"

# Enable job control so backgrounded subprocesses run in their own process
# group. Without this, Ctrl-C is delivered to the whole foreground group;
Expand Down Expand Up @@ -37,6 +40,26 @@ cleanup() {
kill_tree "$SAT_PID"
fi
kill_tree "$HOST_PID"
# mise's task supervisor reparents long-running task scripts to init, so
# kill_tree above can't reach them via PPID. Sweep by absolute paths,
# scoped to this checkout (so other worktrees aren't touched). SIGTERM
# first for anything that listens, brief grace period, then SIGKILL —
# belt-and-suspenders for processes that don't respond to TERM.
#
# `pkill -f` matches its pattern as ERE, so $REPO_ROOT must be regex-
# escaped before interpolating — otherwise a checkout path containing
# regex metacharacters (e.g. `boxel.worktrees/...`, where `.` matches
# any char) would over-match and signal unrelated processes outside
# this checkout. The trailing `node_modules.*--transpileOnly` is an
# INTENTIONAL regex (matching whichever node_modules subpath the
# worker invocation resolves through), so escaping is applied to the
# path prefix only.
REPO_ROOT_RE="$(printf '%s' "$REPO_ROOT" | sed -E 's/[][\\.*^$+?(){}|]/\\&/g')"
pkill -TERM -f "${REPO_ROOT_RE}/mise-tasks/services/" 2>/dev/null || true
pkill -TERM -f "${REPO_ROOT_RE}/packages/realm-server/node_modules.*--transpileOnly worker" 2>/dev/null || true
sleep 2
pkill -KILL -f "${REPO_ROOT_RE}/mise-tasks/services/" 2>/dev/null || true
pkill -KILL -f "${REPO_ROOT_RE}/packages/realm-server/node_modules.*--transpileOnly worker" 2>/dev/null || true
}
trap cleanup EXIT INT TERM

Expand Down
Loading