Skip to content

fix(arcade): give ncurses games a TERM so they launch#36

Merged
ralyodio merged 1 commit into
mainfrom
fix/arcade-ncurses-term
Jun 18, 2026
Merged

fix(arcade): give ncurses games a TERM so they launch#36
ralyodio merged 1 commit into
mainfrom
fix/arcade-ncurses-term

Conversation

@ralyodio

Copy link
Copy Markdown
Contributor

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 with Error opening terminal when TERM is unset. Game subprocesses were built with exec.Command and no cmd.Env, so they inherited the agentbbs systemd daemon's environment, which has no TERM — every game exited before drawing a frame. DOOM was immune because doom-ascii writes ANSI directly and never reads terminfo.

Fix

  • Add Term to plugin.Context, populated from the client PTY (s.Pty().Term).
  • Hand each sandboxed game a curated env (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; ninvaders errors 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), no Error opening terminal. go build ./... clean.

🤖 Generated with Claude Code

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>
@github-actions

Copy link
Copy Markdown

vu1nz Security Review

0 finding(s) in PR #?

No security issues found.

@ralyodio ralyodio merged commit d65c2bc into main Jun 18, 2026
5 checks passed
@ralyodio ralyodio deleted the fix/arcade-ncurses-term branch June 18, 2026 12:42
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.

1 participant