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
  • Loading branch information
rvagg committed Nov 27, 2014
1 parent 574407a commit 9006e94
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();

This comment has been minimized.

Copy link
@MikeBravoE

MikeBravoE Dec 3, 2014

Clean up

fs.writeFileSync(emptyTxt, '');
}
process.on('exit', cleanup);
cleanup();
fs.writeFileSync(emptyTxt, '');

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

2 comments on commit 9006e94

@indutny
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw, you could fork the repo to your github account ;)

@rvagg
Copy link
Member Author

@rvagg rvagg commented on 9006e94 Nov 28, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was going to but baulked in favour of not drawing attention by putting a fork on activity feed. But I guess that horse has bolted!

Please sign in to comment.