Skip to content

Using execArgv with worker_threads.Worker breaks 'NODE_PRESERVE_SYMLINKS' envvar usage in worker. #30627

Closed
@arciisine

Description

@arciisine
  • Version: 12.13.0
  • Platform: Linux

I have a child_process.fork that I am converting to use the worker_threads module. Currently I need to conditionally preserve symlinks, and this information was being passed through environment variables to the forked process. Switching over to worker_threads, this seemed to no longer work by default.

When creating the Worker instance, I am passing the NODE_PRESERVE_SYMLINKS flag in the env object. This fails to to work when execArgv is used as well. By removing execArgv, everything works as expected.

Looking at the docs for Worker's execArgv

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

I can pass the --preserve-symlinks flag as a CLI option, and I've verified that is working. Though this is less than ideal as I need to enforce this conditionally.

Ultimately I'm trying to see if there is something overriding the env usage, or if the env vars, regarding process creation are potentially being ignored.

Metadata

Metadata

Assignees

No one assigned

    Labels

    workerIssues and PRs related to Worker support.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions