I'm using NodeJS to do two things:
- Start a server and listen on a port
- Run a grunt task
The calls are as follows:
node livereload.js
grunt watch
But the problem is that the first call doesn't allow subsequent tasks to be run! So I have to do CTRL+C in the cmd to run another command.
Even doing:
node livereload.js & grunt watch
Doesn't work! Do I have to do something in the livereload.js file to make it exit the command so I can call another one?
The file looks like:
var lrserver = require('tiny-lr')();
lrserver.listen(35729, function(err) { console.log('LR Server Started'); });
I've even tried:
node livereload
.exit
grunt watch
But that doesn't work either.
Update: It seems that the grunt watch command is in fact being run with my first code example, but because it doesn't get exited it doesn't show the console logs from grunt because it's still on the livereload one. Any ideas what the best way to fix this is then?
What's the correct way to do CTRL+C but from NodeJS? It would seem I need to do this after the console.log