summaryrefslogtreecommitdiff
path: root/test/parallel/test-child-process-exec-stdout-stderr-data-string.js
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2016-06-23 10:51:48 -0700
committerRich Trott <rtrott@gmail.com>2016-06-30 16:04:54 -0700
commit0268fd0a9f3a1bfcb9a544017414a39400a4bcfd (patch)
tree8e4b5d84691b27ff6601cb37f4d357685a8aafca /test/parallel/test-child-process-exec-stdout-stderr-data-string.js
parent8da541bf5f42031ad966c6b92bb1e153c44eb778 (diff)
downloadandroid-node-v8-0268fd0a9f3a1bfcb9a544017414a39400a4bcfd.tar.gz
android-node-v8-0268fd0a9f3a1bfcb9a544017414a39400a4bcfd.tar.bz2
android-node-v8-0268fd0a9f3a1bfcb9a544017414a39400a4bcfd.zip
child_process: preserve argument type
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
Diffstat (limited to 'test/parallel/test-child-process-exec-stdout-stderr-data-string.js')
-rw-r--r--test/parallel/test-child-process-exec-stdout-stderr-data-string.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/parallel/test-child-process-exec-stdout-stderr-data-string.js b/test/parallel/test-child-process-exec-stdout-stderr-data-string.js
new file mode 100644
index 0000000000..8ab834c98f
--- /dev/null
+++ b/test/parallel/test-child-process-exec-stdout-stderr-data-string.js
@@ -0,0 +1,23 @@
+'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);
+});