Skip to content

fix(bridge): handle async spawn 'error' + default MAME bin to /usr/games/mame#227

Merged
privaloops merged 1 commit intomainfrom
fix/bridge-spawn-error-handling
Apr 27, 2026
Merged

fix(bridge): handle async spawn 'error' + default MAME bin to /usr/games/mame#227
privaloops merged 1 commit intomainfrom
fix/bridge-spawn-error-handling

Conversation

@privaloops
Copy link
Copy Markdown
Owner

Two related fixes after debugging launches on the Pi:

  1. ENOENT ("binary not found") fires asynchronously as an 'error'
    event on the ChildProcess, not a synchronous throw. MameProcess
    only listened to 'exit', so Node escalated the unhandled 'error'
    into a process-wide exception and the systemd service died on every
    missing-binary attempt. Now both events are caught, the first one
    that fires emits a spawn-error ExitReason, and the bridge stays
    alive. Two new test cases pin the contract.

  2. systemd's default PATH doesn't include /usr/games, the directory
    Debian uses for MAME. A bare spawn("mame") found nothing even
    though the binary was installed. Default the bridge's MAME binary
    to /usr/games/mame, with SPRIXE_BRIDGE_MAME_BIN as the override for
    other distros. The Pi service unit now sets the env var
    explicitly so the resolution is unambiguous.

…mes/mame

Two related fixes after debugging launches on the Pi:

1. ENOENT ("binary not found") fires asynchronously as an 'error'
   event on the ChildProcess, not a synchronous throw. MameProcess
   only listened to 'exit', so Node escalated the unhandled 'error'
   into a process-wide exception and the systemd service died on every
   missing-binary attempt. Now both events are caught, the first one
   that fires emits a spawn-error ExitReason, and the bridge stays
   alive. Two new test cases pin the contract.

2. systemd's default PATH doesn't include /usr/games, the directory
   Debian uses for MAME. A bare spawn("mame") found nothing even
   though the binary was installed. Default the bridge's MAME binary
   to /usr/games/mame, with SPRIXE_BRIDGE_MAME_BIN as the override for
   other distros. The Pi service unit now sets the env var
   explicitly so the resolution is unambiguous.
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
sprixe-frontend Ready Ready Preview, Comment Apr 27, 2026 7:27am

@privaloops privaloops merged commit a5ede99 into main Apr 27, 2026
1 check was pending
@privaloops privaloops deleted the fix/bridge-spawn-error-handling branch April 27, 2026 07:26
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