← ClaudeAtlas

cross-platform-shelllisted

Rules for bash scripts, wrappers, and CI steps in this repo that must run identically on macOS, Linux, and Windows Git Bash (MSYS), plus the bisection workflow for hangs that reproduce only in CI.
FoxsterDev/xuunity-mcp · ★ 1 · AI & Automation · score 74
Install: claude install-skill FoxsterDev/xuunity-mcp
# Cross-Platform Shell Guidelines This repo's shell entrypoints (`xuunity_light_unity_mcp.sh`, `templates/run.sh`, `scripts/testing/*.sh`) are executed on macOS, Linux, and Windows Git Bash. Every rule below was earned from a real silent-hang incident on Windows CI. Violating them produces hangs with zero output that eat the whole CI job time limit. --- ## 1. Path Walks Terminate on a Fixed Point, Never on `/` On Windows, `pwd`/paths can take forms like `D:/a/repo` or `D:\a\repo`. A `dirname` descent walks `D:/a → D: → . → .` and **never reaches `/`** — the loop spins forever inside `$(...)` with no output. ```bash # INCORRECT (infinite loop on Windows path forms) while [[ "$candidate" != "/" ]]; do candidate="$(dirname "$candidate")" done # CORRECT (terminates on any path form: /, //, D:, .) local previous_candidate="" while [[ -n "$candidate" && "$candidate" != "$previous_candidate" ]]; do previous_candidate="$candidate" candidate="$(dirname "$candidate")" done ``` ## 2. Resolve Git Bash Explicitly When Spawning From Native Code `subprocess.run(["bash", ...])` from Python on Windows resolves through CreateProcess search order to the **System32 WSL stub**, not Git Bash. Use `tests/bash_support.py:resolve_bash_executable()` — it prefers `Git/usr/bin/bash.exe` (the real binary) over the `Git/bin` shim, which also makes process-tree kill reliable. ## 3. No `xargs -P` Under MSYS Parallel `xargs` is unreliable under MSYS fork emulation (known upstream hangs). The