Repository navigation
Conversation
new Worker(filename, { env }) builds the worker's process.env as Node's
constructor does. undefined or null copies the parent's environment, as
before. An object gives the worker its own enumerable string-keyed
properties, each converted with String(); names that are array indices
are left out, as in Node. SHARE_ENV (the symbol registered as
nodejs.worker_threads.SHARE_ENV) has the worker and its parent use the
process environment. Any other value throws ERR_INVALID_ARG_TYPE. The
option is checked after argv and before name. SHARE_ENV from a worker
that has its own copy of the environment is refused.
After the first SHARE_ENV worker starts, process.env reads, writes,
deletes and enumeration of the process environment hold a lock on POSIX
hosts. Programs without such a worker take no lock.
Child processes spawned in a worker without an env option now inherit
the worker's process.env, as Node passes process.env. Before, they
inherited the process environment.
The worker unit recognizes SHARE_ENV through scr_dyn_symbol_key_fn,
which the symbol unit installs when its registry first holds a symbol.
Programs without symbols do not link the symbol unit.
Corpus 5998-5999 match Node v24.22.0.
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| scr_arr_release(inherited); | ||
| pid_t pid = -1; | ||
| int spawn_err = posix_spawnp(&pid, cmd->data, &fa, NULL, argv, environ); | ||
| int spawn_err = posix_spawnp(&pid, cmd->data, &fa, NULL, argv, envp != NULL ? envp : environ); |
Contributor
scr_worker.h is compiled without SCR_WORKERS (the runtime's common-symbols check), where scr_core.h does not declare the ScrContextEnv typedef. scr_worker_thread_start's environment parameter now uses struct ScrContextEnv, the same type.
This branch was successfully deployed
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.
new Worker(file, { env })accepts an object orSHARE_ENVand builds the worker'sprocess.envas Node does, including Node's validation and its omission of array-index names.process.env.SHARE_ENVworker take no environment lock; corpus 5998-5999 match Node v24.22.0.