Skip to content

Commit 013527a

Browse files
committed
test: don't remove empty.txt on win32
on win32 we use empty.txt in the fixtures directory, otherwise we use a file constructed specifically for this test due to POSIX socket path length limitations, in which case we need to do appropriate cleanup Reviewed-By: Fedor Indutny <fedor@indutny.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> PR-URL: #2
1 parent d23326b commit 013527a

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

test/simple/test-net-pipe-connect-errors.js

+11-10
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,20 @@ if (process.platform === 'win32') {
4242
// use common.PIPE to ensure we stay within POSIX socket path length
4343
// restrictions, even on CI
4444
emptyTxt = common.PIPE + '.txt';
45-
}
4645

47-
function cleanup() {
48-
try {
49-
fs.unlinkSync(emptyTxt);
50-
} catch (e) {
51-
if (e.code != 'ENOENT')
52-
throw e;
46+
function cleanup() {
47+
try {
48+
fs.unlinkSync(emptyTxt);
49+
} catch (e) {
50+
if (e.code != 'ENOENT')
51+
throw e;
52+
}
5353
}
54+
process.on('exit', cleanup);
55+
cleanup();
56+
fs.writeFileSync(emptyTxt, '');
5457
}
55-
process.on('exit', cleanup);
56-
cleanup();
57-
fs.writeFileSync(emptyTxt, '');
58+
5859
var notSocketClient = net.createConnection(emptyTxt, function() {
5960
assert.ok(false);
6061
});

0 commit comments

Comments
 (0)