mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
675 B
30 lines
675 B
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const fork = require('child_process').fork;
|
|
|
|
var cp = fork(common.fixturesDir + '/child-process-message-and-exit.js');
|
|
|
|
let gotMessage = false;
|
|
let gotExit = false;
|
|
let gotClose = false;
|
|
|
|
cp.on('message', common.mustCall(function(message) {
|
|
assert(!gotMessage);
|
|
assert(!gotClose);
|
|
assert.strictEqual(message, 'hello');
|
|
gotMessage = true;
|
|
}));
|
|
|
|
cp.on('exit', common.mustCall(function() {
|
|
assert(!gotExit);
|
|
assert(!gotClose);
|
|
gotExit = true;
|
|
}));
|
|
|
|
cp.on('close', common.mustCall(function() {
|
|
assert(gotMessage);
|
|
assert(gotExit);
|
|
assert(!gotClose);
|
|
gotClose = true;
|
|
}));
|
|
|