Skip to content

fix(runtime): support module-mode process workers - #1842

Open
toprameen wants to merge 3 commits into
bendlang:mainfrom
toprameen:isolate-process-worker-flags
Open

toprameen wants to merge 3 commits into
bendlang:mainfrom
toprameen:isolate-process-worker-flags

Conversation

@toprameen

@toprameen toprameen commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Running an emitted program through node --input-type=module -e 'await import("./program.cjs")' made Process.run return Fail(5): its helper worker inherited module mode and require was unavailable. The worker now obtains a local require before initialization, preserving inherited permission controls and preloads.

The new JS integration fixture compiles a real Bend program, runs it through Node with both module-flag spellings, and checks its output and a useful worker preload. It fails on the original runtime and passes with the fix.

Node isn't a dependency for the test suite, and instead of adding it, I've made it so the test is skipped if it isn't available in PATH, following precedent elsewhere in the code. Let me know if you would rather I added Node as a dependency instead.

Local checks on macOS with Node 25.8.2 and Bun 1.4.2: source and freshly compiled Bend, emitted Bun/Node, packed test layout, permission deny/allow behavior, and preload auditing. Repository gate: 54/54.

@toprameen
toprameen marked this pull request as ready for review October 24, 2026 01:19
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