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

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: https://github.com/nodejs/node/pull/7391 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Jackson Tian <shyvo1987@gmail.com> Fixes: https://github.com/nodejs/node/issues/7342 Refs: https://github.com/nodejs/node/issues/1901
24 lines
546 B
JavaScript
24 lines
546 B
JavaScript
'use strict';
|
|
// Refs: https://github.com/nodejs/node/issues/7342
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const exec = require('child_process').exec;
|
|
|
|
var stdoutCalls = 0;
|
|
var stderrCalls = 0;
|
|
|
|
const command = common.isWindows ? 'dir' : 'ls';
|
|
exec(command).stdout.on('data', (data) => {
|
|
stdoutCalls += 1;
|
|
});
|
|
|
|
exec('fhqwhgads').stderr.on('data', (data) => {
|
|
assert.strictEqual(typeof data, 'string');
|
|
stderrCalls += 1;
|
|
});
|
|
|
|
process.on('exit', () => {
|
|
assert(stdoutCalls > 0);
|
|
assert(stderrCalls > 0);
|
|
});
|