Skip to content

fix: portable signalExitCode via os.constants.signals#23

Open
rohitg00 wants to merge 1 commit into
vercel-labs:mainfrom
rohitg00:rohitg00/fix-signal-exit-code-portability
Open

fix: portable signalExitCode via os.constants.signals#23
rohitg00 wants to merge 1 commit into
vercel-labs:mainfrom
rohitg00:rohitg00/fix-signal-exit-code-portability

Conversation

@rohitg00
Copy link
Copy Markdown

Summary

signalExitCode in scripts/zero-cli.mjs hardcoded a signal-number map using Linux values (e.g. SIGBUS: 7). On Darwin those numbers differ — SIGBUS is 10, not 7 — so a native compiler crash terminated by signal reports the wrong exit code on macOS.

Node already exposes the correct per-platform values via os.constants.signals. This swap removes the hardcoded table and gets each host's actual numbers.

Test plan

  • node -e "console.log(128 + require('os').constants.signals.SIGBUS)" returns 138 on Darwin (was 135 with old table)
  • node -e "console.log(128 + require('os').constants.signals.SIGSEGV)" returns 139 on both platforms
  • npm run docs:test passes
  • Unknown-signal fallback (?? 1) preserved

The hardcoded signal map used Linux signal numbers (SIGBUS=7), which is
wrong on Darwin where SIGBUS=10. Subprocesses terminated by signal would
exit with the wrong code on macOS. Use os.constants.signals so each host
reports the right number.
@vercel
Copy link
Copy Markdown

vercel Bot commented May 16, 2026

@rohitg00 is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

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