mirror of
https://github.com/nodejs/node.git
synced 2025-05-06 18:17:17 +00:00

The tap skipping output is so prevalent yet obscure in nature that we ought to move it into it's own function in test/common.js PR-URL: https://github.com/nodejs/node/pull/6697 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
46 lines
1.0 KiB
JavaScript
46 lines
1.0 KiB
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const cluster = require('cluster');
|
|
const http = require('http');
|
|
|
|
if (common.isWindows) {
|
|
common.skip('It is not possible to send pipe handles over ' +
|
|
'the IPC pipe on Windows');
|
|
return;
|
|
}
|
|
|
|
if (cluster.isMaster) {
|
|
common.refreshTmpDir();
|
|
var ok = false;
|
|
var worker = cluster.fork();
|
|
worker.on('message', function(msg) {
|
|
assert.equal(msg, 'DONE');
|
|
ok = true;
|
|
});
|
|
worker.on('exit', function() {
|
|
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() {
|
|
http.get({ socketPath: common.PIPE, path: '/' }, function(res) {
|
|
res.resume();
|
|
res.on('end', function(err) {
|
|
if (err) throw err;
|
|
process.send('DONE');
|
|
process.exit();
|
|
});
|
|
});
|
|
});
|