fix(arcade): give ncurses games a TERM so they launch#36
Merged
Conversation
The 80s arcade classics (Space Invaders/nInvaders, Pac-Man/pacman4console, Tetris/tint, Moon Patrol/moon-buggy) are ncurses programs: initscr() fails with "Error opening terminal" when TERM is unset. Game subprocesses were built with exec.Command and no Env, so they inherited the agentbbs systemd daemon's environment — which has no TERM — and every game exited before drawing a frame. DOOM was unaffected because doom-ascii writes ANSI directly and never touches terminfo. Thread the client PTY's TERM through plugin.Context and hand each sandboxed game a curated environment (TERM, PATH, HOME, LANG=C.UTF-8) instead of the daemon's. Curating the env also stops leaking operator secrets (e.g. COINPAY_API_KEY) into third-party game binaries. Verified live on bbs.profullstack.com: Space Invaders and Pac-Man now render; previously all four died instantly. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
vu1nz Security Review0 finding(s) in PR #? No security issues found. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
None of the new 80s arcade games worked on bbs.profullstack.com — Space Invaders (nInvaders), Pac-Man (pacman4console), Tetris (tint), Moon Patrol (moon-buggy). DOOM worked.
Root cause
The arcade classics are ncurses programs;
initscr()fails withError opening terminalwhenTERMis unset. Game subprocesses were built withexec.Commandand nocmd.Env, so they inherited the agentbbs systemd daemon's environment, which has noTERM— every game exited before drawing a frame. DOOM was immune becausedoom-asciiwrites ANSI directly and never reads terminfo.Fix
Termtoplugin.Context, populated from the client PTY (s.Pty().Term).TERM,PATH,HOME,LANG=C.UTF-8) instead of the daemon's. Bonus: stops leaking operator secrets (e.g.COINPAY_API_KEY) into third-party game binaries.Verification
Confirmed on the host: daemon env has no
TERM;ninvaderserrors without it and renders with it. Drove the live BBS arcade with this build hand-installed — Space Invaders and Pac-Man now render (score/level/ghost HUD), noError opening terminal.go build ./...clean.🤖 Generated with Claude Code