I am currently trying to perform several steps that require tasks to be spawned into child processes. For example:
I can easily use a tasks like grunt-concurrent to have both of these run simultaneously. However, when I exit grunt, the child process (in this case - the static site generator which I am running using grunt-shell) keeps running. I would like to have these tasks run simultaneously - but also have them be killed when grunt exits.
Thoughts?
Not sure how this works with grunt-shell. But if you'd setup a custom grunt task to run your server you could try somthing like:
var spawn = require('child_process').spawn;
var server = spawn('myserver', ['--foo']);
process.on('exit', function() {
grunt.log.writeln('killing myserver...');
server.kill();
grunt.log.writeln('killed myserver');
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With