scripts(scripts): 🔨 Add logging and error handling to game execution script for debugging and crash reporting

Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
Claude Code 2026-04-10 18:22:41 -07:00
parent 30aa0a0949
commit fad1257db6

View file

@ -2,10 +2,19 @@
# Dev commands: play, editor, lint, format, test, verify, screenshot
cmd_play() {
local LOG_FILE="$REPO_ROOT/.project/logs/game_$(date +%Y%m%d_%H%M%S).log"
mkdir -p "$(dirname "$LOG_FILE")"
echo -e "${BLUE}Launching Magic Civilization...${NC}"
echo -e "${BLUE}Log: $LOG_FILE${NC}"
WAYLAND_DISPLAY="${WAYLAND_DISPLAY:-wayland-0}" \
XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR:-/run/user/$(id -u)}" \
$GODOT_BIN --path "$GAME_DIR" --rendering-method gl_compatibility "$@"
$GODOT_BIN --path "$GAME_DIR" --rendering-method gl_compatibility "$@" 2>&1 | tee "$LOG_FILE"
local EXIT_CODE=${PIPESTATUS[0]}
if [ $EXIT_CODE -ne 0 ]; then
echo -e "\n${RED}Game exited with code $EXIT_CODE${NC}"
echo -e "${RED}Crash log: $LOG_FILE${NC}"
tail -20 "$LOG_FILE" | grep -E "SCRIPT ERROR|ERROR:|Crash|FATAL|at:" | head -10
fi
}
cmd_editor() {