redis-server.js 382 B

1234567891011121314151617
  1. var P = require('bluebird');
  2. var spawn = require('child_process').spawn;
  3. var redisSrv;
  4. var port = exports.port = 18543;
  5. exports.connect = function () {
  6. redisSrv = spawn('redis-server', [
  7. '--port', port,
  8. '--loglevel', 'notice',
  9. ], { stdio: 'inherit' });
  10. return P.delay(1500);
  11. };
  12. exports.disconnect = function () {
  13. redisSrv.kill('SIGKILL');
  14. return P.resolve();
  15. };