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

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>
This commit is contained in:
Anthony Ettinger 2026-06-18 12:01:26 +00:00
parent beba7dc388
commit 481e715d89
3 changed files with 29 additions and 0 deletions

View file

@ -25,6 +25,11 @@ type Context struct {
// Host is the BBS hostname (e.g. bbs.profullstack.com), for building
// member homepage URLs (https://Host/~name) and similar links.
Host string
// Term is the client PTY's terminal type (e.g. xterm-256color). Needed by
// sandboxed ncurses games (Space Invaders, Pac-Man, Tetris, Moon Patrol),
// which call initscr() and fail with "Error opening terminal" if TERM is
// unset — the systemd daemon environment has no TERM to inherit.
Term string
}
// Plugin is the only integration point between a feature and the hub.