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:
parent
30aa0a0949
commit
fad1257db6
1 changed files with 10 additions and 1 deletions
|
|
@ -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() {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue