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

In the tests, we use "process.platform === 'win32'" in some places. This patch replaces them with the "common.isWindows" for consistency. PR-URL: https://github.com/nodejs/io.js/pull/2269 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
32 lines
841 B
JavaScript
32 lines
841 B
JavaScript
'use strict';
|
|
var common = require('../common');
|
|
var assert = require('assert');
|
|
var cluster = require('cluster');
|
|
var net = require('net');
|
|
|
|
if (common.isWindows) {
|
|
console.log('1..0 # Skipped: not reliable on Windows');
|
|
return;
|
|
}
|
|
|
|
if (process.getuid() === 0) {
|
|
console.log('1..0 # Skipped: as this test should not be run as `root`');
|
|
return;
|
|
}
|
|
|
|
if (cluster.isMaster) {
|
|
// Master opens and binds the socket and shares it with the worker.
|
|
cluster.schedulingPolicy = cluster.SCHED_NONE;
|
|
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();
|
|
}));
|
|
}
|