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)
This commit is contained in:
Scott Carver
2018-11-10 15:51:32 -08:00
parent 3beefe0925
commit 1a6ec88c2d

View File

@@ -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 = '';