-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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: preserve argument type #7391
Conversation
stdoutLen += chunk.byteLength; | ||
stdoutLen += chunk instanceof Buffer ? | ||
chunk.length : | ||
Buffer.byteLength(chunk, encoding); |
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.
Can you at least line these two lines up with chunk
? Same for the other instance of this below.
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.
Aligned.
35485cd
to
4c7266b
Compare
Looks like the |
@mscdex Whoops, yeah, fixed, I hope, let's try again... |
CI looks good. /cc @bnoordhuis @cjihrig |
kill(); | ||
} else { | ||
_stdout.push(chunk); | ||
if (!encoding) |
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.
Can you drop the negation and flip the clauses?
This reverts commit c9a5990.
A previous fix for a `maxBuffer` bug resulted in a change to the argument type for the `data` event on `child.stdin` and `child.stdout` when using `child_process.exec()`. This fixes the `maxBuffer` bug in a way that does not have that side effect. Fixes: nodejs#7342 Refs: nodejs#1901
CI again, hoping my |
Modified tests for Windows. Let's try again: |
That CI is green. Woot. @bnoordhuis I put quotation marks around |
LGTM
I agree. |
/cc @cjihrig @JacksonTian |
I'll land this in 24 hours if no one objects. An additional |
A previous fix for a `maxBuffer` bug resulted in a change to the argument type for the `data` event on `child.stdin` and `child.stdout` when using `child_process.exec()`. This fixes the `maxBuffer` bug in a way that does not have that side effect. PR-URL: #7391 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Jackson Tian <shyvo1987@gmail.com> Fixes: #7342 Refs: #1901
@Trott lts? |
@thealphanerd Yes if #6764 lands on LTS, otherwise no. |
I've gone ahead and landed this as #6764 landed. Do you think we would be better without either of these changes? Is there any chance of a regression? |
A previous fix for a `maxBuffer` bug resulted in a change to the argument type for the `data` event on `child.stdin` and `child.stdout` when using `child_process.exec()`. This fixes the `maxBuffer` bug in a way that does not have that side effect. PR-URL: #7391 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Jackson Tian <shyvo1987@gmail.com> Fixes: #7342 Refs: #1901
@thealphanerd I think we're better off with these changes than without them. |
A previous fix for a `maxBuffer` bug resulted in a change to the argument type for the `data` event on `child.stdin` and `child.stdout` when using `child_process.exec()`. This fixes the `maxBuffer` bug in a way that does not have that side effect. PR-URL: #7391 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Jackson Tian <shyvo1987@gmail.com> Fixes: #7342 Refs: #1901
A previous fix for a `maxBuffer` bug resulted in a change to the argument type for the `data` event on `child.stdin` and `child.stdout` when using `child_process.exec()`. This fixes the `maxBuffer` bug in a way that does not have that side effect. PR-URL: #7391 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Jackson Tian <shyvo1987@gmail.com> Fixes: #7342 Refs: #1901
A previous fix for a `maxBuffer` bug resulted in a change to the argument type for the `data` event on `child.stdin` and `child.stdout` when using `child_process.exec()`. This fixes the `maxBuffer` bug in a way that does not have that side effect. PR-URL: #7391 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Jackson Tian <shyvo1987@gmail.com> Fixes: #7342 Refs: #1901
Checklist
make -j4 test
(UNIX) orvcbuild test nosign
(Windows) passesAffected core subsystem(s)
child_process
Description of change
A previous fix for a
maxBuffer
bug resulted in a change to theargument type for the
data
event onchild.stdin
andchild.stdout
when using
child_process.exec()
.This fixes the
maxBuffer
bug in a way that does not have that sideeffect.
Fixes: #7342
Refs: #1901
Alternative to #7381 (which changes the argument type and is arguably
semver-major
for that reason--being affected by it requires relying on undocumented behavior and usingexec()
in ways that are better suited tofork()
orspawn()
which are unaffected by either fix).