Description: Launch an instance of redis-server during tests
 and kill it at the end.
 .
 Upstream rejected this patch since it requires a more specific
 setup for the machine with the tests running and makes difficult
 run test with different redis-server versions.
Author: Leo Iannacone <l3on@ubuntu.com>
Forwarded: https://github.com/mranney/node_redis/issues/608

---
 test.js |   12 ++++++++++++
 1 file changed, 12 insertions(+)

--- a/test.js
+++ b/test.js
@@ -2,6 +2,16 @@
 var PORT = 6379;
 var HOST = '127.0.0.1';
 
+// redis server child process
+var redis_server_child = require("child_process")
+                         .spawn("redis-server", ["--port", PORT,
+                                                "--unixsocket", "/tmp/redis.sock",
+                                                "--unixsocketperm", 777
+                                                ]);
+redis_server_child.stdout.on('data', function(data) {
+  console.log("[redis-server] " + data);
+});
+
 var redis = require("./index"),
     client = redis.createClient(PORT, HOST),
     client2 = redis.createClient(PORT, HOST),
@@ -2224,6 +2234,7 @@
         client.quit();
         client2.quit();
         bclient.quit();
+        process.exit(0);
     }
 };
 
@@ -2270,4 +2281,5 @@
 process.on('exit', function (code) {
     assert.equal(true, connected);
     assert.equal(true, ended);
+    redis_server_child.kill();
 });
