Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fork method, args parameter cannot be null #22154

Closed
wallet77 opened this issue Aug 6, 2018 · 3 comments
Closed

fork method, args parameter cannot be null #22154

wallet77 opened this issue Aug 6, 2018 · 3 comments
Labels
child_process Issues and PRs related to the child_process subsystem. doc Issues and PRs related to the documentations. help wanted Issues that need assistance from volunteers or PRs that need help to proceed.

Comments

@wallet77
Copy link

wallet77 commented Aug 6, 2018

  • 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 ?

@vsemozhetbyt vsemozhetbyt added child_process Issues and PRs related to the child_process subsystem. doc Issues and PRs related to the documentations. labels Aug 6, 2018
@fesebuv
Copy link

fesebuv commented Aug 7, 2018

That seems to be the intended behavior, since arguments[pos] != null. So it seems we are expecting at least one argument that is not a null.

@ZYSzys
Copy link
Member

ZYSzys commented Dec 24, 2018

It seems that the document has said the args parameter should be an Array of string:

args {string[]} List of string arguments.

@jasnell jasnell added the help wanted Issues that need assistance from volunteers or PRs that need help to proceed. label Jun 26, 2020
@jasnell
Copy link
Member

jasnell commented Jul 6, 2020

Testing locally, passing null appears to work as expected. It's likely this was fixed along the way somewhere. Closing but we can reopen if it turns out that there is still something left to do

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
child_process Issues and PRs related to the child_process subsystem. doc Issues and PRs related to the documentations. help wanted Issues that need assistance from volunteers or PRs that need help to proceed.
Projects
None yet
Development

No branches or pull requests

5 participants