From: Rod Vagg Date: Thu, 27 Nov 2014 22:43:15 +0000 (+1100) Subject: test: don't remove empty.txt on win32 X-Git-Tag: v1.0.0-release~258 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=013527ad1c6a1e8f94965b55c0f33dcdab0492d5;p=platform%2Fupstream%2Fnodejs.git 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 Reviewed-By: Ben Noordhuis PR-URL: https://github.com/iojs/io.js/pull/2 --- diff --git a/test/simple/test-net-pipe-connect-errors.js b/test/simple/test-net-pipe-connect-errors.js index e29d50e73..07dd4fe4a 100644 --- a/test/simple/test-net-pipe-connect-errors.js +++ b/test/simple/test-net-pipe-connect-errors.js @@ -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); });