Skip to content

Commit 85a63f3

Browse files
committed
src: make sure pass the cli_options to worker
1 parent 4e9ce7c commit 85a63f3

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/node_worker.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,9 @@ void Worker::New(const FunctionCallbackInfo<Value>& args) {
534534
}
535535

536536
if (args[1]->IsObject() || args[2]->IsArray()) {
537-
per_isolate_opts.reset(new PerIsolateOptions());
537+
Mutex::ScopedLock lock(per_process::cli_options_mutex);
538+
per_isolate_opts.reset(
539+
new PerIsolateOptions(*per_process::cli_options->per_isolate));
538540

539541
HandleEnvOptions(per_isolate_opts->per_env, [&env_vars](const char* name) {
540542
return env_vars->Get(name).FromMaybe("");
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Flags: --expose-internals
2+
'use strict';
3+
require('../common');
4+
const { Worker } = require('worker_threads');
5+
6+
// Test if the flags is passed to worker threads
7+
// See https://github.com/nodejs/node/issues/52825
8+
new Worker(`
9+
// If the --expose-internals flag does not pass to worker
10+
// require function will throw an error
11+
require('internal/options');
12+
`, { eval: true, env: process.env });

0 commit comments

Comments
 (0)