mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
Adds the missing console.error to test-child-process-exec-maxBuffer PR-URL: https://github.com/nodejs/node/pull/14796 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: David Cai <davidcai1993@yahoo.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
32 lines
740 B
JavaScript
32 lines
740 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const cp = require('child_process');
|
|
|
|
function checkFactory(streamName) {
|
|
return common.mustCall((err) => {
|
|
const message = `${streamName} maxBuffer exceeded`;
|
|
assert.strictEqual(err.message, message);
|
|
});
|
|
}
|
|
|
|
{
|
|
const cmd = 'echo "hello world"';
|
|
|
|
cp.exec(cmd, { maxBuffer: 5 }, checkFactory('stdout'));
|
|
}
|
|
|
|
const unicode = '中文测试'; // length = 4, byte length = 12
|
|
|
|
{
|
|
const cmd = `"${process.execPath}" -e "console.log('${unicode}');"`;
|
|
|
|
cp.exec(cmd, {maxBuffer: 10}, checkFactory('stdout'));
|
|
}
|
|
|
|
{
|
|
const cmd = `"${process.execPath}" -e "console.error('${unicode}');"`;
|
|
|
|
cp.exec(cmd, {maxBuffer: 10}, checkFactory('stderr'));
|
|
}
|