title: Kill process and sub-processes in Ruby on Windows
body: <p>Currently I'm doing this in one command prompt</p>
  
  <pre><code>require 'win32/process'
  p = Process.spawn("C:/ruby193/bin/bundle exec rails s")
  puts p
  Process.waitpid(p)
  </code></pre>
  
  <p>and then in another </p>
  
  <pre><code>require 'win32/process'
  Process.kill(1,&lt;p&gt;)
  </code></pre>
  
  <p>The problem is that the process I spawn (the Rails server in this case) spawns a chain of sub-processes.  The kill command doesn't kill them, it just leaves them orphaned with no parent.</p>
  
  <p>Any ideas how can I kill the whole spawned process <em>and all its children</em>?</p>