Skip to content

fork method, args parameter cannot be null #22154

Description

@wallet77
  • Version: 10.5.0 (but I think this is not related)
  • Platform: Ubuntu 18.04.1 LTS (but I think this is not related)
  • Subsystem: child_process

Hi,

I've just realized that this code can't work because args parameter can't be null. But it's not documented and I think it can be disturbing.

childProcess.fork(app.js', null, {
    execPath: process.execPath
  })

But the following will work :

childProcess.fork(app.js', [], {
    execPath: process.execPath
  })

I think this line is related to the issue :

if (pos < arguments.length && arguments[pos] != null) {

I'm not sure if it's the intended behavior, or if it's a lack in the documentation ?

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

    child_processIssues and PRs related to the child_process subsystem.docIssues and PRs related to Node.js documentation.help wantedIssues that need assistance from volunteers or PRs that need help to proceed.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions