Repair scratch setup preflight for repo-local host processes
This commit is contained in:
@@ -14,17 +14,60 @@ SRC_DIR="$REPO_ROOT/src"
|
||||
|
||||
RUN_TESTS=false
|
||||
CONFIGURATION="Debug"
|
||||
STOP_REPO_HOST_PROCESSES=false
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--test|-t) RUN_TESTS=true; shift ;;
|
||||
--stop-repo-host-processes) STOP_REPO_HOST_PROCESSES=true; shift ;;
|
||||
--configuration|-c) CONFIGURATION="$2"; shift 2 ;;
|
||||
*) echo "Unknown option: $1" >&2; exit 1 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
stop_repo_host_processes() {
|
||||
local found=0
|
||||
|
||||
while IFS= read -r line; do
|
||||
[[ -z "$line" ]] && continue
|
||||
|
||||
local pid="${line%% *}"
|
||||
local cmd="${line#* }"
|
||||
|
||||
[[ "$cmd" != *"$REPO_ROOT"* ]] && continue
|
||||
[[ "$cmd" != *"StellaOps."* ]] && continue
|
||||
[[ "$pid" == "$$" ]] && continue
|
||||
|
||||
if (( found == 0 )); then
|
||||
echo "Stopping repo-local Stella host processes before build."
|
||||
fi
|
||||
|
||||
echo " - [$pid] $cmd"
|
||||
kill "$pid" 2>/dev/null || true
|
||||
sleep 1
|
||||
if kill -0 "$pid" 2>/dev/null; then
|
||||
kill -9 "$pid" 2>/dev/null || true
|
||||
fi
|
||||
found=1
|
||||
done < <(ps -eo pid=,args=)
|
||||
|
||||
if (( found == 0 )); then
|
||||
echo "No repo-local Stella host processes detected."
|
||||
else
|
||||
echo "Repo-local Stella host processes stopped."
|
||||
fi
|
||||
}
|
||||
|
||||
if $STOP_REPO_HOST_PROCESSES; then
|
||||
stop_repo_host_processes
|
||||
fi
|
||||
|
||||
# Discover solutions (exclude root StellaOps.sln)
|
||||
mapfile -t SOLUTIONS < <(find "$SRC_DIR" -name '*.sln' ! -name 'StellaOps.sln' | sort)
|
||||
mapfile -t SOLUTIONS < <(
|
||||
find "$SRC_DIR" \
|
||||
\( -path '*/node_modules/*' -o -path '*/bin/*' -o -path '*/obj/*' \) -prune -o \
|
||||
-name '*.sln' ! -name 'StellaOps.sln' -print | sort
|
||||
)
|
||||
|
||||
if [[ ${#SOLUTIONS[@]} -eq 0 ]]; then
|
||||
echo "ERROR: No solution files found under src/." >&2
|
||||
|
||||
Reference in New Issue
Block a user