Skip to content

Commit

Permalink
test: don't remove empty.txt on win32
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
PR-URL: #2
  • Loading branch information
rvagg committed Nov 29, 2014
1 parent d23326b commit 013527a
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions test/simple/test-net-pipe-connect-errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,20 @@ if (process.platform === 'win32') {
// 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);
} catch (e) {
if (e.code != 'ENOENT')
throw e;
function cleanup() {
try {
fs.unlinkSync(emptyTxt);
} catch (e) {
if (e.code != 'ENOENT')
throw e;
}
}
process.on('exit', cleanup);
cleanup();
fs.writeFileSync(emptyTxt, '');
}
process.on('exit', cleanup);
cleanup();
fs.writeFileSync(emptyTxt, '');

var notSocketClient = net.createConnection(emptyTxt, function() {
assert.ok(false);
});
Expand Down

0 comments on commit 013527a

Please sign in to comment.