Repository navigation
fix(io): Process.run's worker loads its modules on Node before 20.16 too - #2226
Merged
Merged
Conversation
Since bendlang#1842 the Process.run worker loads its modules with process.getBuiltinModule, which Node added in v22.3.0 and v20.16.0. On an older Node the worker throws at its first line, and Process.run answers Fail(5) after its timeout plus a second. The worker now falls back to require when getBuiltinModule is missing; on a current Node `??` never reads require, so module-mode workers run as before. process_run_old_node runs a Process.run program under Node with a preload that deletes process.getBuiltinModule: 1 on main, 0 with this change. Co-authored-by: Claude Opus 5.5 <[email protected]>
…n_node_module process_run_old_node copied process_run_node_module's program, build and checks; its preload (delete process.getBuiltinModule) is now a third run there, returning 3 on failure. 0 with the fix, 3 with main's worker. Co-Authored-By: Claude Fable 5.2 <[email protected]>
Lorenzobattistela
approved these changes
Nov 23, 2026
Lorenzobattistela
left a comment
Collaborator
There was a problem hiding this comment.
Reviewed on 07aa362 merged onto main 6b80619: repo 56/56, test 1868/1868, perf 124/124, ping 84/84, safe with 0 false rejects. No correctness findings.
I pushed b76461b: the old-Node case is now a third run inside process_run_node_module instead of a separate test that copied its program, build and checks (prints 0 with the fix, 3 with main's worker). Thanks for the fix.
nicolas-abril
added a commit
to nicolas-abril/bend
that referenced
this pull request
Nov 24, 2026
, bendlang#2224-bendlang#2226, bendlang#2231, bendlang#2285, bendlang#2286, bendlang#2288 and others) One conflict, in emit_unfold: bendlang#2288 annotates an unfolded call's lets with the argument types instantiated by the earlier arguments; bendlang#2162's deep unfold keeps its arguments unannotated there and annotates them the same way after folding (its type walk renamed D, beside bendlang#2288's T). Both kept. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Since #1842 the
Process.runworker loads its modules withprocess.getBuiltinModule, which Node added in v22.3.0 and v20.16.0. On an olderNode the worker throws at its first line. The caller then waits out the run's
timeout plus a second, and gets
Fail(5). This happens for everyProcess.runin aprogram run by that Node, whether as
node p.cjsor in module mode. Bun is notaffected. Ubuntu 24.04 and Debian 12 package Node 18.19 as
nodejs.The worker now uses
getBuiltinModulewhen Node has it andrequireotherwise:Where
getBuiltinModuleexists,??never readsrequire, so a module-mode workeron a current Node runs as before.
Results with this change, for
node p.cjs, and fornode --input-type=module -e 'await import("./p.cjs")'andnode --input-type module -e '...':fail 5: errno 5(about 2.1 s) on all threedone 0 hello(about 0.1 s) on all threedone 0 hellodone 0 hellobun p.cjsdone 0 hellodone 0 helloThe new test
tests/io/process_run_old_nodebuilds that program and runs it withnode --require <preload>, where the preload doesdelete process.getBuiltinModule.A
--requirepreload also runs in worker threads, so this simulates an older Node onany Node. It prints
1on main and0with this change, under both Node 24.22.3 andNode 18.19.1. Like
process_run_node_module, it skips when nonodeis on PATH.The five existing
tests/io/process_run*tests on the JS lane and the interpreter:process_run_node_modulereturns 1 on main and passes here.process_runfails on both builds, at its late stdin reader. That is unrelated:the case relies on bash as
/bin/sh, and this machine has dash (test(io): process_run's late stdin reader keeps its stdin under dash #2225).With Node 24 on PATH, all 245
tests/iotests give the same results on main and withthis change, on the JS lane and on the interpreter. The C lane does not use this file.