From 8cf4170c94fecebf19751300c93138092869e808 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Fri, 22 Feb 2019 21:01:22 +0100 Subject: [PATCH] worker: provide process.execArgv MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Provide `process.execArgv`. If an `execArgv` option is passed to the `Worker` constructor, that option is used as its value; if not, the parent’s `process.execArgv` is inherited (since that also goes for the actual options in that case). PR-URL: https://github.com/nodejs/node/pull/26267 Reviewed-By: Joyee Cheung Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- doc/api/worker_threads.md | 5 ++- src/env-inl.h | 4 +++ src/env.cc | 1 + src/env.h | 2 ++ src/node_worker.cc | 16 ++++++--- src/node_worker.h | 4 ++- test/parallel/test-process-exec-argv.js | 48 +++++++++++++++++-------- test/parallel/test-worker-execargv.js | 7 ++-- 8 files changed, 65 insertions(+), 22 deletions(-) diff --git a/doc/api/worker_threads.md b/doc/api/worker_threads.md index 54bd66a6ea683e..8d4c703f480de2 100644 --- a/doc/api/worker_threads.md +++ b/doc/api/worker_threads.md @@ -428,7 +428,9 @@ if (isMainThread) { not automatically be piped through to `process.stderr` in the parent. * `execArgv` {string[]} List of node CLI options passed to the worker. V8 options (such as `--max-old-space-size`) and options that affect the - process (such as `--title`) are not supported. + process (such as `--title`) are not supported. If set, this will be provided + as [`process.execArgv`][] inside the worker. By default, options will be + inherited from the parent thread. ### Event: 'error'