title: How do I ensure that a spawned Child process is killed if my app panics?
body: <p>I'm writing a small test that starts a daemon process and tests it e.g:</p>
  
  <pre><code>let server = Command::new("target/debug/server").spawn();
  
  // do some tests
  
  server.kill();
  </code></pre>
  
  <p>The typical way to fail a test is to panic. Unfortunately this means that kill() never gets invoked and repeated runs of the test suite fail, because the port is taken by the old process that is still running.</p>
  
  <p>Is there something like a TRAP function that I can use to ensure the Child gets killed? </p>