Skip to content

Instantly share code, notes, and snippets.

@igorzi igorzi/gist:1953469
Created Mar 1, 2012

Embed
What would you like to do?
From d97ed59d1c6d5ca939d5b47c7e498f81c8ec7a32 Mon Sep 17 00:00:00 2001
From: Igor Zinkovsky <igorzi@microsoft.com>
Date: Thu, 1 Mar 2012 13:49:23 -0800
Subject: [PATCH] fix test-net-pipe-connect-errors for windows
---
test/simple/test-net-pipe-connect-errors.js | 33 +++++++++++++++-----------
1 files changed, 19 insertions(+), 14 deletions(-)
diff --git a/test/simple/test-net-pipe-connect-errors.js b/test/simple/test-net-pipe-connect-errors.js
index b659f43..627698d 100644
--- a/test/simple/test-net-pipe-connect-errors.js
+++ b/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);
+ }
});
--
1.7.9.msysgit.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.