-
Notifications
You must be signed in to change notification settings - Fork 30k
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: measure buffer length in bytes #7381
Conversation
@@ -20,7 +20,7 @@ function main(conf) { | |||
const len = +conf.len; | |||
|
|||
const msg = '"' + Array(len).join('.') + '"'; | |||
const options = { 'stdio': ['ignore', 'pipe', 'ignore'] }; | |||
const options = {'stdio': ['ignore', 'ipc', 'ignore']}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merge error on my part that undoes a change that came in after the commit I reverted. Will fix it momentarily...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. Thanks!
This reverts commit c9a5990.
This change fixes a known issue where `maxBuffer` limits by characters rather than bytes. Benchmark added to confirm no performance regression occurs with this change. This necessarily changes default behavior of `stdout` and `stderr` callbacks such that they receive buffers rather than strings. The alternative would be a performance hit on the defaults. Refs: nodejs#6764 Refs: nodejs#1901
Closing in favor of non-semver-major #7391 |
Checklist
make -j4 test
(UNIX) orvcbuild test nosign
(Windows) passesAffected core subsystem(s)
child_process
Description of change
This re-implements a previous fix that had to be reverted. The fix is to measure the
maxBuffer
option ofchild_process.exec()
in bytes (per the documentation and user expectations) and not characters.Unfortunately, the fix had a side effect such the
child.stdout
andchild.stderr
data
events sent their callbacks buffers by default rather than strings. This is undocumented but fully exposed and caused bugs in userland (e.g., https://github.com/tes/bosco/issues/152).This PR depends on #7377. It re-implements the change, but this time it is marked
semver-major
and tests are added to confirm the behavior change.