-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
child_process: execFile and fork arg parsing ambiguity #2681
Comments
@jasnell: Would you rather see the argument parsing in execFile be replaced? Or just made more complete? |
Either really. If there's going to be argument checking it needs to be consistent. |
@jasnell: So I was running through the contribution guide and I got up to the testing section. I'm seeing odd behavior that I'm hoping you can clear up for me. I ran I then switched to the unaltered and up-to-date master branch and ran the same command multiple times. Master also exhibited the same behavior. Before I go diving into tests that are seemingly unrelated, can you tell me if this is a known issue? Here's an example of a few of the errors I'm seeing. The errors themselves are inconsistent too; different builds result in different errors.
|
There are some tests that are known to be flaky on some operating systems.
|
The argument parsing for execFile and fork are inconsistent. execFile throws on one invalid argument but not others. fork has similar logic but the implementation is very different. This update implements consistency for both functions. Fixes: nodejs#2681
Proposed fix in #7399 |
Fixes: nodejs#2681 Refs: nodejs#4508 PR-URL: nodejs#7399 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
See: #2667 (comment)
When it lands, #2667 will bring over the v0.12 changes that improved argument parsing in child_process execFile and fork. However, even with that change, argument parsing is still too ambiguous and ought to be tightened up. For instance,
execFile('ls',{a:1},'test')
goes through without a throw even tho a string is passed in for the callback. Internally, execFile just acts as if the callback wasn't provided at all. Likewise,execFile('ls',[], 'test', function() {})
does not throw either. Nor doesexecFile('ls',[],'test','test')
. The only type that is actually checked is the args, so that if you pass inexecFile('ls', 'test')
, a TypeError will throw.For v4.0.0, the priority is on landing #2667 to ensure parity with v0.12, but moving forward we'll want to tighten up the argument parsing here (and likely in other places as well).
@trevnorris (@nodejs/api)
The text was updated successfully, but these errors were encountered: