title: Watch, recompile, and restart
body: <p>I have been looking all over for an example of a way to use Grunt's watch module to perform a few steps in order when a file change occurs. I haven't found a good example of any of this, so if someone could point me in the right direction that would be great.</p>
  
  <ol>
  <li>Build TypeScript project (I have this working)</li>
  <li>Watch directories for file changes (this works too)</li>
  <li>Start running the compiled JavaScript in a node process, while still watching for file changes (what's the best way to do this via Grunt? The watch module seems to kick off the recompile task OK)</li>
  <li>On file change, stop the other running process, recompile, and restart when finished. Keep watching for changes (No idea on this one - the restart is the tricky part!)</li>
  </ol>
  
  <p>I've tried a few different ways such as starting a child process with Grunt, but I always end up with dangling processes, locked up ports, misdirected STDIO, or other issues. I'd like for the child processes to be killed if the Grunt process exits.</p>
  
  <p>Is there a good way to handle this? Thanks!</p>