Uh oh!
There was an error while loading. Please reload this page.
child_process: allow Infinity as maxBuffer value - #10769
Conversation
sam-github
commented
Jan 12, 2017
+1 for feature, but needs docs and tests across all child_process APIs that support maxBuffer. Doesn't have to test that the behaviour is unlimited, but should test that it doesn't abort or throw arg typerrors. |
There was a problem hiding this comment.
Perhaps include a fail test for -Infinity
There was a problem hiding this comment.
Hm, I'm not sure that JavaScript Infinity will convert to C++ properly here.
There was a problem hiding this comment.
OK, so JavaScript Infinity translates to std::numeric_limits<double>::infinity() in C++. So, I changed max_buffer_ to a double.
mscdex
commented
Jan 12, 2017
For consistency, we should probably add the same conditionals to the async counterparts. |
There was a problem hiding this comment.
Error message needs to be updated to reflect the new constraint (It now accepts any positive number, not just unsigned integer).
There was a problem hiding this comment.
That's a good point. The integer check is still required otherwise we'll have nonsense things like 0.1 accepted as the maxBuffer. The check should likely be something like:
if ((Number.isInteger(options.maxBuffer) || options.maxBuffer === Infinity) &&
options.maxBuffer >= 0) {
...
}
And the error message should certainly be updated but that would upgrade this to a semver-major change
There was a problem hiding this comment.
0.1 is technically fine as a maxBuffer value, even if it is a bit weird. We're just going to be doing comparisons against the value to see if we surpass it.
And the error message should certainly be updated but that would upgrade this to a semver-major change
This builds on an existing semver major change, so this is going to be semver major regardless.
There was a problem hiding this comment.
That's a good point. The integer check is still required otherwise we'll have nonsense things like 0.1 accepted as the maxBuffer. The check should likely be something like:
if ((Number.isInteger(options.maxBuffer) || options.maxBuffer === Infinity) &&
options.maxBuffer >= 0) {
...
}
And the error message should certainly be updated but that would upgrade this to a semver-major change
Instead of "non-negative", can we use "positive"? |
cjihrig
commented
Jan 13, 2017
But zero is an allowed, non-positive value. |
mscdex
commented
Jan 13, 2017
It depends on which zero you're talking about ;-) |
cjihrig
commented
Jan 13, 2017
Ha. Ok, I'll make it just "positive" |
cjihrig
commented
Jan 16, 2017
cjihrig
commented
Jan 16, 2017
Another CI run because Windows: https://ci.nodejs.org/job/node-test-pull-request/5891/ |
cjihrig
commented
Jan 17, 2017
Another CI run: https://ci.nodejs.org/job/node-test-pull-request/5911/ |
Fixes: nodejs#10767 PR-URL: nodejs#10769 Reviewed-By: James M Snell <jasnell@gmail.com>
This commit refactors test-child-process-spawnsync-maxbuf.js, and adds testing for the case where maxBuffer is Infinity. PR-URL: nodejs#10769 Reviewed-By: James M Snell <jasnell@gmail.com>
Fixes: nodejs#10767 PR-URL: nodejs#10769 Reviewed-By: James M Snell <jasnell@gmail.com>
This commit refactors test-child-process-spawnsync-maxbuf.js, and adds testing for the case where maxBuffer is Infinity. PR-URL: nodejs#10769 Reviewed-By: James M Snell <jasnell@gmail.com>
sam-github
commented
Apr 12, 2017
@cjihrig why is this semver-major? Is it because you added validation for some args? |
cjihrig
commented
Apr 12, 2017
Yes. |
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
child_process
Closes#10767