Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

fix test-net-pipe-connect-errors for windows

  • Loading branch information...
Igor Zinkovsky
Igor Zinkovsky committed Mar 1, 2012
1 parent 8cdbf01 commit 67b10f816c5bc72e1b251b800fa0987bc08d8847
Showing with 19 additions and 14 deletions.
  1. +19 −14 test/simple/test-net-pipe-connect-errors.js
@@ -53,29 +53,34 @@ noEntSocketClient.on('error', function(err) {
});


// Trying to connect to a socket one has no access to should result in EACCES
var accessServer = net.createServer(function() {
assert.ok(false);
});
accessServer.listen(common.PIPE, function() {
fs.chmodSync(common.PIPE, 0);

var accessClient = net.createConnection(common.PIPE, function() {
// On Windows a chmod has no effect on named pipes
if (process.platform !== 'win32') {
// Trying to connect to a socket one has no access to should result in EACCES
var accessServer = net.createServer(function() {
assert.ok(false);
});
accessServer.listen(common.PIPE, function() {
fs.chmodSync(common.PIPE, 0);

accessClient.on('error', function(err) {
assert.equal(err.code, 'EACCES');
accessErrorFired = true;
accessServer.close();
var accessClient = net.createConnection(common.PIPE, function() {
assert.ok(false);
});

accessClient.on('error', function(err) {
assert.equal(err.code, 'EACCES');
accessErrorFired = true;
accessServer.close();
});
});
});
}


// Assert that all error events were fired
process.on('exit', function() {
assert.ok(notSocketErrorFired);
assert.ok(noEntErrorFired);
assert.ok(accessErrorFired);
if (process.platform !== 'win32') {
assert.ok(accessErrorFired);
}
});

0 comments on commit 67b10f8

Please sign in to comment.
You can’t perform that action at this time.