Skip to content

make_game: Ctrl+C and end of input give one line, not a traceback - #910

Closed
quackottu wants to merge 2 commits into
ItsNotRexed:mainfrom
quackottu:make-game-interrupt
Closed

quackottu wants to merge 2 commits into
ItsNotRexed:mainfrom
quackottu:make-game-interrupt

Conversation

@quackottu

Copy link
Copy Markdown
Contributor

New BUILD item, claimed in #634 (#634 (comment)).

make_game.py had no interrupt handling:

  • Ctrl+C anywhere, a long shader stage or a prompt, printed a Python traceback, though every stage resumes on the next run ("A stopped build continues where it left off", README).
  • End of input at the Which one? or Game folder: prompt (Ctrl+Z / Ctrl+D, or a console that gives no input) raised EOFError out of choose_game. make_game.py --check in such a console, with no copy found, ended in that traceback.

Changes:

  • choose_game: EOFError at either prompt fails with the same --game hint the non-interactive path already gives.
  • cli() wraps main(): KeyboardInterrupt prints Stopped. Run it again to continue where it left off. and exits 130. main() itself is unchanged, so the existing tests calling it see no difference.
  • tests/test_make_game_interrupt.py: both prompts at end of input (exit 1 with the hint), Ctrl+C (exit 130 and the one line), and a normal return passing through. With main's make_game.py it errors.

Tested on Windows 11 Pro (26300), Python 3.12.10: all ten tests/test_make_game_*.py pass; python -I make_game.py --check < NUL-style run with no copy present now ends with ERROR: No folder given. Give the folder with --game. (exit 1). No game files.

AI-assisted.

ItsNotRexed and others added 2 commits November 21, 2026 23:29
Updated project status to indicate early development phase.
Ctrl+C anywhere printed a Python traceback, and end of input at the
"Which one?" or "Game folder:" prompt raised EOFError from choose_game.
The prompts now fail with the --game hint, and cli() reports Ctrl+C as
"Stopped. Run it again to continue where it left off." with exit 130.
@poststructural

Copy link
Copy Markdown

Tried pr910 on Linux (Python 3.14); AI-assisted. The parent side works: exit 130 and the one line. But a Ctrl+C during a stage still prints a traceback, from the child.

A console Ctrl+C goes to every process in the foreground group (on Windows, CTRL_C_EVENT goes to every process attached to the console), so the tool py() / run() started gets it too. Reproduced with pr910's make_game.py, main replaced by a run([sys.executable, "-I", "sleeper.py"]) that sleeps, and SIGINT sent to the process group:

    python3 -I .../sleeper.py
Traceback (most recent call last):
  File ".../sleeper.py", line 2, in <module>
    time.sleep(30)
KeyboardInterrupt

Stopped. Run it again to continue where it left off.
exit: 130

Most of a build is spent inside such children (rdna2spirv.py, awc_opus.py, audio_wav.py, …), so that's the case users will usually hit. Two options: give the Python tools the same except KeyboardInterrupt: sys.exit(130) at their entry point, or start them from py() with SIGINT ignored in the child (preexec_fn/signal.SIG_IGN on POSIX; on Windows CREATE_NEW_PROCESS_GROUP) and have the parent stop them after its own KeyboardInterrupt. The EOFError prompt changes look right.

@abilliontokens

Copy link
Copy Markdown
Contributor

Review: the make_game.py change is correct, but the PR as pushed would also add an unrelated README line — rebase onto origin/main and force-push before merge.

What's in the branch (Windows 11 26200, Python 3.12.10; CPU-only, no game files):

  • git log d1211d0..pr-910 → 31590ba plus 43d0015 ("Clarify project status in README"). The branch's base is 43d0015, which is not on origin/main (main was force-pushed to 067d3e8). gh pr diff 910 shows README.md | 2 +: that commit restores a base58 token-address line under the Discord link that origin/main does not have. The PR body only describes the interrupt handling, so this looks like base drift from the old main, not part of the change; merging it would republish the line.
  • On the PR head (31590ba): python -I tests/test_make_game_interrupt.py → 4 tests OK.
  • Negative control with d1211d0's make_game.py: 4 errors (EOFError out of choose_game; no cli).
  • Code review: cli() wraps only main(), so existing callers/tests see no change; KeyboardInterrupt → one stderr line + exit 130; EOFError at both prompts → the existing fail() path (exit 1, --game hint); nothing else is caught, so real exceptions still traceback. Stages already resume, so the 130 path adds no partial state.

Suggestion: git rebase origin/main (dropping 43d0015) and force-push; the rest is ready.

AI-assisted (omp orchestrator).

@bobcatchris

Copy link
Copy Markdown
Contributor

Heads-up, same thing that was just found in my #891: this PR's head carries a commit that is not on main and that adds a contract address to README.md under the Discord link:

CA 8T3ztDSKxYK15SUBseqLeviqQwfcG9wUeDGP1wjBpump

The commit is 43d0015 (or its twin 5d9c7d1), message Clarify project status in README, authored NotRexed <notrexed@gmail.com>. It sat on main for a window earlier today and is not an ancestor of main any more, so the branch was cut from a main that has since been rewritten. It survives a normal rebase because it does not touch anything you changed.

Fix, from the branch:

git fetch origin main
git rebase --onto origin/main 43d0015
git push --force-with-lease

(or the same with 5d9c7d1 if that is the one in your log; git log --oneline origin/main..HEAD shows which). git diff --stat origin/main...HEAD should then list only your files.

Not accusing anyone: it looks like an orphaned commit from the rewritten main, and three open PRs have it. Worth dropping anyway — merging it would publish a token address into the README under the project's name, and that is not something a PR should smuggle in.

AI-assisted.

@ItsNotRexed

Copy link
Copy Markdown
Owner

Merged into main as 6bb8f4f. Your branch carried two README commits that were removed from main's history, so I replayed your own commits onto main without them, which is why GitHub doesn't show this PR as merged. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants