mirror of
https://github.com/nodejs/node.git
synced 2025-05-09 17:22:44 +00:00

This patch uses `return` statement to skip the test instead of using `process.exit` call. PR-URL: https://github.com/nodejs/io.js/pull/2109 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
30 lines
717 B
JavaScript
30 lines
717 B
JavaScript
'use strict';
|
|
var common = require('../common');
|
|
var assert = require('assert');
|
|
var cluster = require('cluster');
|
|
var net = require('net');
|
|
|
|
if (process.platform === 'win32') {
|
|
console.log('1..0 # Skipped: not reliable on Windows.');
|
|
return;
|
|
}
|
|
|
|
if (process.getuid() === 0) {
|
|
console.log('Do not run this test as root.');
|
|
process.exit(0);
|
|
}
|
|
|
|
if (cluster.isMaster) {
|
|
cluster.fork().on('exit', common.mustCall(function(exitCode) {
|
|
assert.equal(exitCode, 0);
|
|
}));
|
|
}
|
|
else {
|
|
var s = net.createServer(assert.fail);
|
|
s.listen(42, assert.fail.bind(null, 'listen should have failed'));
|
|
s.on('error', common.mustCall(function(err) {
|
|
assert.equal(err.code, 'EACCES');
|
|
process.disconnect();
|
|
}));
|
|
}
|