mirror of
https://github.com/nodejs/node.git
synced 2026-11-21 12:59:16 -05:00
test: use common.PIPE for emptyTxt path
Work-around for long paths exceeding limits for UNIX socket binds, emptyTxt would otherwise be burried deep in the fixtures directory. PR-URL: https://github.com/node-forward/node/pull/51 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
1 parent
c3d3c8e8cd
commit
1f79e4f4b4
1 file changed
+12
-1
@@ -31,7 +31,18 @@ var accessErrorFired = false;
|
|||||||
|
|
||||||
// Test if ENOTSOCK is fired when trying to connect to a file which is not
|
// Test if ENOTSOCK is fired when trying to connect to a file which is not
|
||||||
// a socket.
|
// a socket.
|
||||||
var emptyTxt = path.join(common.fixturesDir, 'empty.txt');
|
var emptyTxt = common.PIPE + '.txt';
|
||||||
|
function cleanup() {
|
||||||
|
try {
|
||||||
|
fs.unlinkSync(emptyTxt);
|
||||||
|
} catch (e) {
|
||||||
|
if (e.code != 'ENOENT')
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
process.on('exit', cleanup);
|
||||||
|
cleanup();
|
||||||
|
fs.writeFileSync(emptyTxt, '');
|
||||||
var notSocketClient = net.createConnection(emptyTxt, function() {
|
var notSocketClient = net.createConnection(emptyTxt, function() {
|
||||||
assert.ok(false);
|
assert.ok(false);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in new issue
Block a user