summaryrefslogtreecommitdiff
path: root/test/parallel/test-child-process-send-type-error.js
diff options
context:
space:
mode:
authorcjihrig <cjihrig@gmail.com>2016-02-16 15:12:56 -0500
committercjihrig <cjihrig@gmail.com>2016-02-22 11:53:38 -0500
commit1952844f45f8944f7c6920e836d0deb3de210efd (patch)
treea7fd70d902365e72f61e4c49540d65eac38dc5b1 /test/parallel/test-child-process-send-type-error.js
parent18abb3ccc2e0917e1371ab9afae4852bdeaa298c (diff)
downloadandroid-node-v8-1952844f45f8944f7c6920e836d0deb3de210efd.tar.gz
android-node-v8-1952844f45f8944f7c6920e836d0deb3de210efd.tar.bz2
android-node-v8-1952844f45f8944f7c6920e836d0deb3de210efd.zip
child_process: support options in send()
This commit adds an options object to process.send(). The same object is propagated to process._send(), the _handleQueue, and the send() and postSend() functions of the handle converter. Fixes: https://github.com/nodejs/node/issues/4271 PR-URL: https://github.com/nodejs/node/pull/5283 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'test/parallel/test-child-process-send-type-error.js')
-rw-r--r--test/parallel/test-child-process-send-type-error.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/parallel/test-child-process-send-type-error.js b/test/parallel/test-child-process-send-type-error.js
new file mode 100644
index 0000000000..b92d1ee90b
--- /dev/null
+++ b/test/parallel/test-child-process-send-type-error.js
@@ -0,0 +1,25 @@
+'use strict';
+require('../common');
+const assert = require('assert');
+const cp = require('child_process');
+
+function noop() {}
+
+function fail(proc, args) {
+ assert.throws(() => {
+ proc.send.apply(proc, args);
+ }, /"options" argument must be an object/);
+}
+
+let target = process;
+
+if (process.argv[2] !== 'child')
+ target = cp.fork(__filename, ['child']);
+
+fail(target, ['msg', null, null]);
+fail(target, ['msg', null, '']);
+fail(target, ['msg', null, 'foo']);
+fail(target, ['msg', null, 0]);
+fail(target, ['msg', null, NaN]);
+fail(target, ['msg', null, 1]);
+fail(target, ['msg', null, null, noop]);