|
@ -53,29 +53,34 @@ noEntSocketClient.on('error', function(err) { |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Trying to connect to a socket one has no access to should result in EACCES
|
|
|
// On Windows a chmod has no effect on named pipes
|
|
|
var accessServer = net.createServer(function() { |
|
|
if (process.platform !== 'win32') { |
|
|
assert.ok(false); |
|
|
// Trying to connect to a socket one has no access to should result in EACCES
|
|
|
}); |
|
|
var accessServer = net.createServer(function() { |
|
|
accessServer.listen(common.PIPE, function() { |
|
|
|
|
|
fs.chmodSync(common.PIPE, 0); |
|
|
|
|
|
|
|
|
|
|
|
var accessClient = net.createConnection(common.PIPE, function() { |
|
|
|
|
|
assert.ok(false); |
|
|
assert.ok(false); |
|
|
}); |
|
|
}); |
|
|
|
|
|
accessServer.listen(common.PIPE, function() { |
|
|
|
|
|
fs.chmodSync(common.PIPE, 0); |
|
|
|
|
|
|
|
|
accessClient.on('error', function(err) { |
|
|
var accessClient = net.createConnection(common.PIPE, function() { |
|
|
assert.equal(err.code, 'EACCES'); |
|
|
assert.ok(false); |
|
|
accessErrorFired = true; |
|
|
}); |
|
|
accessServer.close(); |
|
|
|
|
|
|
|
|
accessClient.on('error', function(err) { |
|
|
|
|
|
assert.equal(err.code, 'EACCES'); |
|
|
|
|
|
accessErrorFired = true; |
|
|
|
|
|
accessServer.close(); |
|
|
|
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Assert that all error events were fired
|
|
|
// Assert that all error events were fired
|
|
|
process.on('exit', function() { |
|
|
process.on('exit', function() { |
|
|
assert.ok(notSocketErrorFired); |
|
|
assert.ok(notSocketErrorFired); |
|
|
assert.ok(noEntErrorFired); |
|
|
assert.ok(noEntErrorFired); |
|
|
assert.ok(accessErrorFired); |
|
|
if (process.platform !== 'win32') { |
|
|
|
|
|
assert.ok(accessErrorFired); |
|
|
|
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|