Skip to content

worker: enable passing command line flags - #25467

Closed
yaelhe wants to merge 3 commits into
nodejs:masterfrom
yaelhe:worker-options
Closed

worker: enable passing command line flags#25467
yaelhe wants to merge 3 commits into
nodejs:masterfrom
yaelhe:worker-options

Conversation

@yaelhe

Copy link
Copy Markdown
Contributor

This PR adds the ability to provide Workers with their own
execArgv flags in replacement of the main thread's execArgv. Only
per-Isolate/per-Environment options are allowed. Per-Process options
and V8 flags are not allowed. Passing an empty execArgv array will
reset per-Isolate and per-Environment options of the Worker to their
defaults. If execArgv option is not passed, the Worker will get
the same flags as the main thread.

Usage example:

const worker = new Worker(__filename, {
execArgv: ['--trace-warnings'],
});
Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

This PR adds the ability to provide Workers with their own
execArgv flags in replacement of the main thread's execArgv. Only
per-Isolate/per-Environment options are allowed. Per-Process options
and V8 flags are not allowed. Passing an empty execArgv array will
reset per-Isolate and per-Environment options of the Worker to their
defaults. If execArgv option is not passed, the Worker will get
the same flags as the main thread.
Usage example:
```
const worker = new Worker(__filename, {
execArgv: ['--trace-warnings'],
});
```
@nodejs-github-botnodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. labels Jan 12, 2019
@Trott

Copy link
Copy Markdown
Member

@nodejs/workers

@TrottTrott added the worker Issues and PRs related to Worker support. label Jan 13, 2019

@addaleaxaddaleax left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, nice work!

Comment threaddoc/api/worker_threads.md
Comment threadlib/internal/validators.js Outdated
Comment threadsrc/node_worker.cc Outdated
Comment threadsrc/node_worker.cc Outdated
@yaelhe

Copy link
Copy Markdown
ContributorAuthor

Updated with @addaleax 's suggestions.

@addaleax

addaleax commented Jan 13, 2019

Copy link
Copy Markdown
Member

CI: https://ci.nodejs.org/job/node-test-pull-request/20080/ (:heavy_check_mark:)

Comment threaddoc/api/worker_threads.md
@addaleaxaddaleax added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jan 14, 2019
@danbev

Copy link
Copy Markdown
Contributor

Landed in 01cd219.

@danbevdanbev closed this Jan 18, 2019
danbev pushed a commit that referenced this pull request Jan 18, 2019
This PR adds the ability to provide Workers with their own
execArgv flags in replacement of the main thread's execArgv. Only
per-Isolate/per-Environment options are allowed. Per-Process options
and V8 flags are not allowed. Passing an empty execArgv array will
reset per-Isolate and per-Environment options of the Worker to their
defaults. If execArgv option is not passed, the Worker will get
the same flags as the main thread.
Usage example:
```
const worker = new Worker(__filename, {
execArgv: ['--trace-warnings'],
});
```
PR-URL: #25467
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
@addaleaxaddaleax added the semver-minor PRs that contain new features and should be released in the next minor version. label Jan 23, 2019
targos pushed a commit that referenced this pull request Jan 24, 2019
This PR adds the ability to provide Workers with their own
execArgv flags in replacement of the main thread's execArgv. Only
per-Isolate/per-Environment options are allowed. Per-Process options
and V8 flags are not allowed. Passing an empty execArgv array will
reset per-Isolate and per-Environment options of the Worker to their
defaults. If execArgv option is not passed, the Worker will get
the same flags as the main thread.
Usage example:
```
const worker = new Worker(__filename, {
execArgv: ['--trace-warnings'],
});
```
PR-URL: #25467
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
@MylesBorinsMylesBorins mentioned this pull request Jan 24, 2019
MylesBorins added a commit that referenced this pull request Jan 24, 2019
Notable Changes:
* events:
* For unhandled `error` events with an argument that is not an
`Error` object, the resulting exeption will have more information
about the argument.
#25621
* child_process:
* When the `maxBuffer` option is passed, `stdout` and `stderr` will
be truncated rather than unavailable in case of an error.
#24951
* policy:
* Experimental support for module integrity checks through a manifest
file is implemented now.
#23834
* n-api:
* The `napi_threadsafe_function` feature is now stable.
#25556
* report:
* An experimental diagnostic API for capturing process state is
available as `process.report` and through command line flags.
#22712
* tls:
* `tls.connect()` takes a `timeout` option analogous to the
`net.connect()` one.
#25517
* worker:
* `process.umask()` is available as a read-only function inside Worker
threads now.
#25526
* An `execArgv` option that supports a subset of Node.js command line
options is supported now.
#25467
PR-URL: #25687
MylesBorins added a commit that referenced this pull request Jan 25, 2019
Notable Changes:
* events:
* For unhandled `error` events with an argument that is not an
`Error` object, the resulting exeption will have more information
about the argument.
#25621
* child_process:
* When the `maxBuffer` option is passed, `stdout` and `stderr` will
be truncated rather than unavailable in case of an error.
#24951
* policy:
* Experimental support for module integrity checks through a manifest
file is implemented now.
#23834
* n-api:
* The `napi_threadsafe_function` feature is now stable.
#25556
* report:
* An experimental diagnostic API for capturing process state is
available as `process.report` and through command line flags.
#22712
* tls:
* `tls.connect()` takes a `timeout` option analogous to the
`net.connect()` one.
#25517
* worker:
* `process.umask()` is available as a read-only function inside Worker
threads now.
#25526
* An `execArgv` option that supports a subset of Node.js command line
options is supported now.
#25467
PR-URL: #25687
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs that have at least one approval, no pending requests for changes, and a CI started.c++Issues and PRs that require attention from people who are familiar with C++.lib / srcIssues and PRs related to general changes in the lib or src directory.semver-minorPRs that contain new features and should be released in the next minor version.workerIssues and PRs related to Worker support.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants

@yaelhe@Trott@addaleax@danbev@jdalton@benjamingr@joyeecheung@BethGriggs@nodejs-github-bot