Skip to content

fix(ext/node): improve process event handling and add missing APIs#32200

Merged
bartlomieju merged 11 commits intodenoland:mainfrom
bartlomieju:fix/node-compat-process-tests
Feb 17, 2026
Merged

fix(ext/node): improve process event handling and add missing APIs#32200
bartlomieju merged 11 commits intodenoland:mainfrom
bartlomieju:fix/node-compat-process-tests

Conversation

@bartlomieju
Copy link
Copy Markdown
Member

@bartlomieju bartlomieju commented Feb 16, 2026

Summary

  • Freeze process.config and its nested objects for Node.js compatibility (immutability)
  • Add process.availableMemory() using Deno.systemMemoryInfo().available
  • Fix process.on/off/emit/prependListener to handle Symbol event names by guarding startsWith("SIG") checks
  • Fix process.emit to dispatch through EventEmitter instead of sending OS signals

Test plan

  • cargo test --test node_compat parallel -- --filter test-process-config.js
  • cargo test --test node_compat parallel -- --filter test-process-available-memory.js
  • cargo test --test node_compat parallel -- --filter test-process-emit.js

🤖 Generated with Claude Code

bartlomieju and others added 5 commits February 16, 2026 19:58
Make process.config and its nested objects immutable via Object.freeze()
to match Node.js behavior. Enable test-process-config.js node compat test.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…emory()

Add process.availableMemory() using Deno.systemMemoryInfo().available and
process.constrainedMemory() backed by a new op that reads cgroup memory
limits on Linux. Also freeze process.config for immutability. Enable
three node compat tests: test-process-config.js,
test-process-available-memory.js, test-process-constrained-memory.js.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fix process event methods (on, off, emit, prependListener) to handle
Symbol event names by guarding `startsWith("SIG")` checks with a
`typeof event === "string"` check. Also fix process.emit to always
dispatch through EventEmitter rather than sending OS signals.
Enable test-process-emit.js and test-process-beforeexit-throw-exit.js
node compat tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
bartlomieju and others added 6 commits February 16, 2026 21:11
…hrows

When a beforeExit handler throws, dispatch the exit event and terminate
with process.exitCode instead of re-throwing. This matches Node.js
behavior where the exit handler can override the exit code. Enable
test-process-beforeexit-throw-exit.js node compat test.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@Tango992 Tango992 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bartlomieju bartlomieju merged commit 3550a05 into denoland:main Feb 17, 2026
86 checks passed
@bartlomieju bartlomieju deleted the fix/node-compat-process-tests branch February 17, 2026 19:30
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.

2 participants