From 1a6ec88c2db1346e68f4a1531165d53c6d538e7c Mon Sep 17 00:00:00 2001 From: Scott Carver Date: Sat, 10 Nov 2018 15:51:32 -0800 Subject: [PATCH] Fix travis subprocess.kill problem - attempt 3 - Don't connect to pipes of spawned yawn process (we don't need them, and they can prevent us from exiting the mocha process) - agent: false to avoid keeping http connection alive even after get is finished (also keeping mocha process alive) --- test/server_process.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/test/server_process.js b/test/server_process.js index 5bbe981..a77a6a5 100644 --- a/test/server_process.js +++ b/test/server_process.js @@ -14,24 +14,22 @@ describe('server process', function() { console.log("launching server...") server_proc = child_process.spawn('yarn', ['dev'], { cwd: '.', - shell: '/bin/bash', - detached: true + stdio: 'ignore' }); server_proc.on('exit', function(code, signal) { server_exited = true; }); - return (new Promise(function(done) { + return (new Promise(function(resolve) { // @TODO Better way to detect server alive-ness than waiting? - setTimeout(done, SERVER_LAUNCH_WAIT_TIME) + setTimeout(resolve, SERVER_LAUNCH_WAIT_TIME) })); }); after(function() { console.log("killing server...") - server_proc.unref(); - server_proc.kill(); + server_proc.kill('SIGKILL'); }); it('should launch', function() { @@ -51,7 +49,8 @@ describe('server process', function() { http.get({ hostname: 'localhost', port: 8080, - path: '/' + path: '/', + agent: false }, function(res) { var result_data = '';