1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-06 02:15:48 +03:00

Test windows fixes

Replace win-spawn with cross-spawn
This commit is contained in:
Ruben Bridgewater
2016-03-07 23:37:30 +01:00
parent 7ffba03be6
commit 20128fe779
6 changed files with 17 additions and 33 deletions

View File

@@ -4,15 +4,13 @@
var config = require('./config');
var fs = require('fs');
var path = require('path');
var spawn = require('win-spawn');
var spawn = require('cross-spawn');
var tcpPortUsed = require('tcp-port-used');
var bluebird = require('bluebird');
// wait for redis to be listening in
// all three modes (ipv4, ipv6, socket).
function waitForRedis (available, cb, port) {
if (process.platform === 'win32') return cb();
var time = Date.now();
var running = false;
var socket = '/tmp/redis.sock';
@@ -29,14 +27,14 @@ function waitForRedis (available, cb, port) {
tcpPortUsed.check(port, '::1'),
function (ipV4, ipV6) {
if (ipV6 === available && ipV4 === available) {
if (fs.existsSync(socket) === available) {
if (fs.existsSync(socket) === available || process.platform === 'win32') {
clearInterval(id);
return cb();
}
// The same message applies for can't stop but we ignore that case
throw new Error('Port ' + port + ' is already in use. Tests can\'t start.\n');
}
if (Date.now() - time > 6000) {
if (Date.now() - time > 24000) {
throw new Error('Redis could not start on port ' + (port || config.PORT) + '\n');
}
running = false;