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.
43 lines
1.0 KiB
43 lines
1.0 KiB
13 years ago
|
// It is not possible to send pipe handles over the IPC pipe on Windows.
|
||
|
if (process.platform === 'win32') {
|
||
|
process.exit(0);
|
||
|
}
|
||
|
|
||
13 years ago
|
var common = require('../common');
|
||
|
var assert = require('assert');
|
||
|
var cluster = require('cluster');
|
||
|
var http = require('http');
|
||
|
|
||
|
if (cluster.isMaster) {
|
||
|
var ok = false;
|
||
|
var worker = cluster.fork();
|
||
|
worker.on('message', function(msg) {
|
||
|
assert.equal(msg, 'DONE');
|
||
|
ok = true;
|
||
|
});
|
||
13 years ago
|
worker.on('exit', function() {
|
||
13 years ago
|
process.exit();
|
||
|
});
|
||
|
process.on('exit', function() {
|
||
|
assert(ok);
|
||
|
});
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
http.createServer(function(req, res) {
|
||
|
assert.equal(req.connection.remoteAddress, undefined);
|
||
|
assert.equal(req.connection.localAddress, undefined); // TODO common.PIPE?
|
||
|
res.writeHead(200);
|
||
|
res.end('OK');
|
||
|
}).listen(common.PIPE, function() {
|
||
|
var self = this;
|
||
|
http.get({ socketPath: common.PIPE, path: '/' }, function(res) {
|
||
12 years ago
|
res.resume();
|
||
13 years ago
|
res.on('end', function(err) {
|
||
|
if (err) throw err;
|
||
|
process.send('DONE');
|
||
|
process.exit();
|
||
|
});
|
||
|
});
|
||
|
});
|