mirror of
https://github.com/nodejs/node.git
synced 2025-05-06 19:49:19 +00:00

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. PR-URL: https://github.com/nodejs/node/pull/6764 Fixes: https://github.com/nodejs/node/issues/1901 Reviewed-By: Brian White <mscdex@mscdex.net>
16 lines
465 B
JavaScript
16 lines
465 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const cp = require('child_process');
|
|
const unicode = '中文测试'; // Length = 4, Byte length = 13
|
|
|
|
if (process.argv[2] === 'child') {
|
|
console.error(unicode);
|
|
} else {
|
|
const cmd = `${process.execPath} ${__filename} child`;
|
|
|
|
cp.exec(cmd, {maxBuffer: 10}, common.mustCall((err, stdout, stderr) => {
|
|
assert.strictEqual(err.message, 'stderr maxBuffer exceeded');
|
|
}));
|
|
}
|