ReviewOS

home-lang/home

Port Bun spawnSync timeout and event-loop isolation semantics

#93
Closed chris opened this 11 days ago ·
11 days ago

Scope

Activate and pass the copied Bun fixtures:

  • js/bun/spawn/spawnsync-no-microtask-drain.test.ts
  • js/bun/spawn/spawnsync-isolated-event-loop.test.ts

Required behavior

  • Apply Bun.spawnSync({ timeout }) as an absolute monotonic deadline while draining child pipes.
  • Terminate and reap timed-out children without losing already captured output.
  • Report Bun-compatible exitCode, string signalCode, and exitedDueToTimeout.
  • Keep timers and microtasks from draining inside synchronous child execution.
  • Execute compound nested -e programs through the real Home runtime instead of a broad synthetic process.exit() shortcut.
  • Add exact-corpus repository regressions and pass the full Home test gate.

Tracks the next bounded tranche of #66 and #81.

11 days ago

Implemented and published on main in 1e5491c590e2163b1e3adf6711be4226259c2aac (feat(test): port spawnSync isolation semantics).

What landed:

  • native spawnSync pipe draining now uses one absolute monotonic timeout deadline
  • timed-out children receive SIGTERM, are drained and reaped, and preserve captured output
  • results expose Bun-compatible string signalCode plus exitedDueToTimeout
  • the legacy eval shortcut now only intercepts scripts consisting solely of process.exit(n), allowing compound child programs to execute in Home
  • both copied Bun isolation fixtures are active with permanent exact-corpus regressions

Verification:

  • spawnsync-no-microtask-drain.test.ts: 3 pass, 0 fail/todo/unsupported
  • spawnsync-isolated-event-loop.test.ts: 4 pass, 0 fail/todo/unsupported
  • existing spawnSync.test.ts: 5 pass, 0 fail/unsupported, 1 pre-existing todo
  • ./pantry/.bin/zig build test -Dfilter=home_test --summary failures: passed with zero failures.

Sign in to comment on this issue.