From b594e59543b2e269be7a374f29be8eafb1d683c8 Mon Sep 17 00:00:00 2001 From: Rod Vagg Date: Tue, 18 Nov 2014 17:31:46 -0800 Subject: [PATCH] test: named pipe is invalid when appending .txt On Windows, appending '.txt' to a named pipe does not produce a valid regular file name. We want an empty _file_, not an invalid named pipe. Fix-up for commit 1f79e4f. PR-URL: https://github.com/node-forward/node/pull/63 Reviewed-By: Ben Noordhuis --- test/simple/test-net-pipe-connect-errors.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/test/simple/test-net-pipe-connect-errors.js b/test/simple/test-net-pipe-connect-errors.js index 7db7108c6a4..e29d50e73e3 100644 --- a/test/simple/test-net-pipe-connect-errors.js +++ b/test/simple/test-net-pipe-connect-errors.js @@ -31,7 +31,19 @@ var accessErrorFired = false; // Test if ENOTSOCK is fired when trying to connect to a file which is not // a socket. -var emptyTxt = common.PIPE + '.txt'; + +var emptyTxt; + +if (process.platform === 'win32') { + // on Win, common.PIPE will be a named pipe, so we use an existing empty + // file instead + emptyTxt = path.join(common.fixturesDir, 'empty.txt'); +} else { + // use common.PIPE to ensure we stay within POSIX socket path length + // restrictions, even on CI + emptyTxt = common.PIPE + '.txt'; +} + function cleanup() { try { fs.unlinkSync(emptyTxt);