child_process: preserve argument type by Trott · Pull Request #7391 · nodejs/node · GitHub
Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 30 additions & 41 deletions lib/child_process.js
31 changes: 31 additions & 0 deletions test/parallel/test-child-process-exec-maxBuffer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
'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.('${unicode}');"`;

cp.exec(cmd, {maxBuffer: 10}, checkFactory('stderr'));
}
15 changes: 0 additions & 15 deletions test/parallel/test-child-process-maxBuffer-stderr.js

This file was deleted.

15 changes: 0 additions & 15 deletions test/parallel/test-child-process-maxBuffer-stdout.js

This file was deleted.

11 changes: 0 additions & 11 deletions test/parallel/test-exec-max-buffer.js

This file was deleted.