-
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 returns strings where doc says it should return a Buffer #3389
Comments
If you think there is a problem with the documentation, feel free to submit a PR improving it :-) |
I considered it but I'm trying to understand the logic first. How do you explain the baffling yet ostensibly deliberate semantic of 'encoding'? |
|
No, that does not, because I long figured it out, since that's precisely Le ven. 16 oct. 2015 02:01, Colin Ihrig [email protected] a écrit :
|
utf8 does not mean string. It's one of several types of string encoding supported by Node. |
It should probably say like |
Clarify that the arguments to child_process.execFile and child_process.exec callback can be Buffer or strings. Fixes: nodejs#3389
Clarify that the arguments to child_process.execFile and child_process.exec callback can be Buffer or strings. Fixes: #3389 PR-URL: #6015 Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
Clarify that the arguments to child_process.execFile and child_process.exec callback can be Buffer or strings. Fixes: #3389 PR-URL: #6015 Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
Doc says:
This was known back in 2013 already
This points out the options parameter's encoding field can force a buffer response. However the default value is supposed to be 'utf8' according to the doc, which strongly implies that it means character encoding, not the type of the return value. The name of this option is terribly misleading.
Demo code:
Output:
The behavior or the documentation need to be changed. If the current behavior is kept, the semantic of 'encoding' should be clarified, and the name of the property should be changed (to 'return_type' for example).
The text was updated successfully, but these errors were encountered: