Skip to content

Instantly share code, notes, and snippets.

@igorzi
Created March 1, 2012 21:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save igorzi/1953469 to your computer and use it in GitHub Desktop.
Save igorzi/1953469 to your computer and use it in GitHub Desktop.
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