From 3ebae6cf1b20ce104423214d75c3c84129a8f141 Mon Sep 17 00:00:00 2001 From: legendecas Date: Thu, 21 Nov 2019 00:55:36 +0800 Subject: worker: add argv constructor option A convenience option to populate `process.argv` in worker threads. PR-URL: https://github.com/nodejs/node/pull/30559 Fixes: https://github.com/nodejs/node/issues/30531 Reviewed-By: Anna Henningsen Reviewed-By: Gireesh Punathil Reviewed-By: Denys Otrishko --- doc/api/worker_threads.md | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'doc') diff --git a/doc/api/worker_threads.md b/doc/api/worker_threads.md index b334a1091b..a93bd5422e 100644 --- a/doc/api/worker_threads.md +++ b/doc/api/worker_threads.md @@ -510,6 +510,9 @@ changes: - version: v13.2.0 pr-url: https://github.com/nodejs/node/pull/26628 description: The `resourceLimits` option was introduced. + - version: REPLACEME + pr-url: https://github.com/nodejs/node/pull/30559 + description: The `argv` option was introduced. --> * `filename` {string} The path to the Worker’s main script. Must be @@ -518,6 +521,10 @@ changes: If `options.eval` is `true`, this is a string containing JavaScript code rather than a path. * `options` {Object} + * `argv` {any[]} List of arguments which would be stringified and appended to + `process.argv` in the worker. This is mostly similar to the `workerData` + but the values will be available on the global `process.argv` as if they + were passed as CLI options to the script. * `env` {Object} If set, specifies the initial value of `process.env` inside the Worker thread. As a special value, [`worker.SHARE_ENV`][] may be used to specify that the parent thread and the child thread should share their -- cgit v1.2.3