Skip to content
Permalink
Browse files
Merge pull request #56 from tomhughes/close-sockets
Make test close listening sockets instead of just removing them
  • Loading branch information
eriktrom committed May 7, 2017
2 parents 20161e8 + 07795bc commit 36613c1416870fab1d37b7a50990e9448b35aa3f
Showing 1 changed file with 15 additions and 5 deletions.
@@ -54,13 +54,23 @@ function createServers (callback) {
}, callback);
}

function stopServers(callback, index) {
if (index < servers.length) {
servers[index].close(function (err) {
if (err) {
callback(err, false);
} else {
stopServers(callback, index + 1);
}
});
} else {
callback(null, true);
}
}

function cleanup(callback) {
fs.rmdirSync(badDir);
glob(path.resolve(socketDir, '*'), function (err, files) {
if (err) { callback(err); }
for (var i = 0; i < files.length; i++) { fs.unlinkSync(files[i]); }
callback(null, true);
});
stopServers(callback, 0);
}

vows.describe('portfinder').addBatch({

0 comments on commit 36613c1

Please sign in to comment.