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 <info@bnoordhuis.nl>
This commit is contained in:
Rod Vagg 2014-11-18 17:31:46 -08:00 committed by Ben Noordhuis
parent fcbbc7a050
commit b594e59543

View File

@ -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);