feat: tie in challenge parser

This commit is contained in:
Mrugesh Mohapatra
2018-09-27 20:21:53 +05:30
parent 03abb0facc
commit eff9ce74bd
19 changed files with 1100 additions and 1099 deletions

View File

@ -0,0 +1,36 @@
require('dotenv').config();
const { spawn } = require('child_process');
const kill = require('tree-kill');
const spawnOpts = {
stdio: 'inherit',
shell: true
};
const loopback = spawn(
'cd',
['./api-server', '&&', 'node development-entry.js'],
spawnOpts
);
const gatsby = spawn('cd', ['./client', '&&', 'npm run develop'], spawnOpts);
function cleanUp() {
console.log(`
Killing processes...
`);
const promises = [
kill(loopback.pid, 'SIGINT', () => Promise.resolve()),
kill(gatsby.pid, 'SIGINT', () => Promise.resolve())
];
return Promise.all(promises).then(() => {
console.log(`
All processes have exited
`);
});
}
process.on('exit', cleanUp);
process.on('SIGINT', cleanUp);
process.on('SIGUSR1', cleanUp);
process.on('SIGUSR2', cleanUp);