diff options
author | Anna Henningsen <anna@addaleax.net> | 2019-02-22 22:11:19 +0300 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2019-03-31 00:25:35 +0300 |
commit | 9fbf0c60b583dae3d34598352c3c7614118cd035 (patch) | |
tree | d615114117264cce1c469f2ff80088dfddf6149b /src/node_credentials.cc | |
parent | 1ee37aac09f263b00029561542cf3bea5db5113b (diff) |
worker: use copy of process.env
Instead of sharing the OS-backed store for all `process.env` instances,
create a copy of `process.env` for every worker that is created.
The copies do not interact. Native-addons do not see modifications to
`process.env` from Worker threads, but child processes started from
Workers do default to the Worker’s copy of `process.env`.
This makes Workers behave like child processes as far as `process.env`
is concerned, and an option corresponding to the `child_process`
module’s `env` option is added to the constructor.
Fixes: https://github.com/nodejs/node/issues/24947
PR-URL: https://github.com/nodejs/node/pull/26544
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Diffstat (limited to 'src/node_credentials.cc')
-rw-r--r-- | src/node_credentials.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/node_credentials.cc b/src/node_credentials.cc index 23b9ad2893d..765d1caba94 100644 --- a/src/node_credentials.cc +++ b/src/node_credentials.cc @@ -43,7 +43,7 @@ bool SafeGetenv(const char* key, std::string* text, Environment* env) { if (env != nullptr) { HandleScope handle_scope(env->isolate()); TryCatch ignore_errors(env->isolate()); - MaybeLocal<String> value = env->envvars()->Get( + MaybeLocal<String> value = env->env_vars()->Get( env->isolate(), String::NewFromUtf8(env->isolate(), key, NewStringType::kNormal) .ToLocalChecked()); |