Pulse/scripts/lib/hot-dev-runtime.sh
rcourtman 8554754f3e Harden managed dev backend recovery
Fix the local hot-dev backend monitor so a missing Pulse process is counted safely under pipefail, keep backend launch stderr in the debug log, and govern the new runtime helper with focused smoke coverage.
2026-05-14 09:19:12 +01:00

21 lines
470 B
Bash

#!/usr/bin/env bash
# Shared helpers for the managed local Pulse development runtime.
hot_dev_pulse_process_count() {
local pattern="${1:-^\./pulse$}"
local count=0
local pid
if ! command -v pgrep >/dev/null 2>&1; then
printf '0\n'
return 0
fi
while IFS= read -r pid; do
[[ -n "${pid}" ]] || continue
count=$((count + 1))
done < <(pgrep -f "${pattern}" 2>/dev/null || true)
printf '%s\n' "${count}"
}