test: unlink custom unix socket before test

Unlink NODE_COMMON_PIPE before running the test if set in the
environment.  The test runner won't do it for us like it does
for files in test/tmp.

PR-URL: https://github.com/node-forward/node/pull/40
Reviewed-By: Rod Vagg <rod@vagg.org>
This commit is contained in:
Ben Noordhuis 2014-10-29 17:21:12 +01:00
parent bf23328a9c
commit 9fb7aee747

View File

@ -37,8 +37,18 @@ if (process.platform === 'win32') {
} else {
exports.PIPE = exports.tmpDir + '/test.sock';
}
if (process.env.NODE_COMMON_PIPE)
if (process.env.NODE_COMMON_PIPE) {
exports.PIPE = process.env.NODE_COMMON_PIPE;
// Remove manually, the test runner won't do it
// for us like it does for files in test/tmp.
try {
fs.unlinkSync(exports.PIPE);
} catch (e) {
// Ignore.
}
}
if (!fs.existsSync(exports.opensslCli))
exports.opensslCli = false;