aboutsummaryrefslogtreecommitdiff
path: root/test/parallel
diff options
context:
space:
mode:
authorcjihrig <cjihrig@gmail.com>2016-10-27 14:36:49 -0400
committercjihrig <cjihrig@gmail.com>2016-11-01 20:37:57 -0400
commit2dcb7f3826a360f7cac79a58833dc4c037f67e27 (patch)
treeaa533b4345de7179fa9bfec300504d8314c09930 /test/parallel
parentf9814a2cafa6c085ab7927f2d53ca87f552fbd0c (diff)
downloadandroid-node-v8-2dcb7f3826a360f7cac79a58833dc4c037f67e27.tar.gz
android-node-v8-2dcb7f3826a360f7cac79a58833dc4c037f67e27.tar.bz2
android-node-v8-2dcb7f3826a360f7cac79a58833dc4c037f67e27.zip
child_process: add public API for IPC channel
This commit adds a public channel property to ChildProcess. The existing _channel property is aliased to the new property, with the intention of deprecating and removing it in the future. Fixes: https://github.com/nodejs/node/issues/9313 PR-URL: https://github.com/nodejs/node/pull/9322 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Diffstat (limited to 'test/parallel')
-rw-r--r--test/parallel/test-child-process-fork-regr-gh-2847.js4
-rw-r--r--test/parallel/test-child-process-fork.js2
-rw-r--r--test/parallel/test-child-process-recv-handle.js4
-rw-r--r--test/parallel/test-child-process-silent.js4
4 files changed, 8 insertions, 6 deletions
diff --git a/test/parallel/test-child-process-fork-regr-gh-2847.js b/test/parallel/test-child-process-fork-regr-gh-2847.js
index 7b4c262fbd..d985b8b4ac 100644
--- a/test/parallel/test-child-process-fork-regr-gh-2847.js
+++ b/test/parallel/test-child-process-fork-regr-gh-2847.js
@@ -44,8 +44,8 @@ var server = net.createServer(function(s) {
}
worker.process.once('close', common.mustCall(function() {
- // Otherwise the crash on `_channel.fd` access may happen
- assert.strictEqual(worker.process._channel, null);
+ // Otherwise the crash on `channel.fd` access may happen
+ assert.strictEqual(worker.process.channel, null);
server.close();
}));
diff --git a/test/parallel/test-child-process-fork.js b/test/parallel/test-child-process-fork.js
index 5ae231ef03..a7d4a995a3 100644
--- a/test/parallel/test-child-process-fork.js
+++ b/test/parallel/test-child-process-fork.js
@@ -5,6 +5,8 @@ var fork = require('child_process').fork;
var args = ['foo', 'bar'];
var n = fork(common.fixturesDir + '/child-process-spawn-node.js', args);
+
+assert.strictEqual(n.channel, n._channel);
assert.deepStrictEqual(args, ['foo', 'bar']);
n.on('message', function(m) {
diff --git a/test/parallel/test-child-process-recv-handle.js b/test/parallel/test-child-process-recv-handle.js
index 5257c46b54..e69cd68d33 100644
--- a/test/parallel/test-child-process-recv-handle.js
+++ b/test/parallel/test-child-process-recv-handle.js
@@ -36,12 +36,12 @@ function master() {
}
function worker() {
- process._channel.readStop(); // Make messages batch up.
+ process.channel.readStop(); // Make messages batch up.
process.stdout.ref();
process.stdout.write('ok\r\n');
process.stdin.once('data', common.mustCall((data) => {
assert.strictEqual(data.toString(), 'ok\r\n');
- process._channel.readStart();
+ process.channel.readStart();
}));
let n = 0;
process.on('message', common.mustCall((msg, handle) => {
diff --git a/test/parallel/test-child-process-silent.js b/test/parallel/test-child-process-silent.js
index ce5e28cc32..50d4ae881a 100644
--- a/test/parallel/test-child-process-silent.js
+++ b/test/parallel/test-child-process-silent.js
@@ -21,8 +21,8 @@ if (process.argv[2] === 'pipe') {
const child = childProcess.fork(process.argv[1], ['pipe'], {silent: true});
// Allow child process to self terminate
- child._channel.close();
- child._channel = null;
+ child.channel.close();
+ child.channel = null;
child.on('exit', function() {
process.exit(0);