Skip to content

worker: process.argv for workers #30531

Description

@legendecas

Is your feature request related to a problem? Please describe.
process.argv is commonly used in Node.js. Right now there is only execArgv for altering how node instance works, which will be filtered process.argv with these only Node.js understands.

Describe the solution you'd like
Add an option argv to Worker constructor's second argument.

new Worker(__filename, { argv: ['foo', 'bar'] })
if (!isMainThread) {
  console.log(process.argv) // ['foo', 'bar']
}

Describe alternatives you've considered
Just use option workerData in Worker constructor's second argument.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestIssues requesting new Node.js features.workerIssues and PRs related to the worker_threads module and Worker API.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions