From d25d2fe37efa157a3a3cf34d32e44f69b49c4004 Mon Sep 17 00:00:00 2001 From: Claude Code Date: Fri, 10 Apr 2026 18:33:54 -0700 Subject: [PATCH] =?UTF-8?q?refactor(scripts):=20=E2=99=BB=EF=B8=8F=20Simpl?= =?UTF-8?q?ify=20and=20improve=20error=20handling=20in=20dev.sh=20by=20reo?= =?UTF-8?q?rganizing=20log=20paths=20and=20updating=20success/failure=20co?= =?UTF-8?q?nditions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Lilith Autocommit --- scripts/run/dev.sh | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/scripts/run/dev.sh b/scripts/run/dev.sh index 9335a94c..19d7c215 100644 --- a/scripts/run/dev.sh +++ b/scripts/run/dev.sh @@ -88,23 +88,21 @@ cmd_test() { } _run_stability_test() { - # Uses the existing screenshot pipeline to boot the game, navigate to - # world_map, wait 20s, and capture a screenshot. If the game crashes - # before the screenshot is taken, the test fails. - local STABILITY_LOG="$REPO_ROOT/.project/logs/stability_$(date +%Y%m%d_%H%M%S).log" - mkdir -p "$(dirname "$STABILITY_LOG")" - "$REPO_ROOT/tools/screenshot.sh" "stability_test" "world_map" "20" > "$STABILITY_LOG" 2>&1 - local RESULT=$? - if [ $RESULT -ne 0 ]; then - echo -e "${RED}FAIL: Stability test failed (exit code $RESULT)${NC}" - tail -10 "$STABILITY_LOG" | grep -E "SCRIPT ERROR|ERROR:" | head -5 + # Boots the game → world_map, waits 20s, captures screenshot. + # If the game crashes before capture, exit code is non-zero. + local LOG="/tmp/stability_test_$$.log" + cmd_screenshot "stability_test" "world_map" "20" > "$LOG" 2>&1 + if [ $? -ne 0 ]; then + echo -e "${RED}FAIL: Game crashed during stability test${NC}" + grep -E "SCRIPT ERROR|ERROR:" "$LOG" | head -5 return 1 fi - if grep -q "SCREENSHOT_PATH:" "$STABILITY_LOG"; then + if grep -q "Captured:" "$LOG"; then echo -e "${GREEN}PASS: Game stable for 20s, screenshot captured${NC}" return 0 else echo -e "${RED}FAIL: Game ran but no screenshot captured${NC}" + cat "$LOG" | tail -5 return 1 fi }