Permalink
Browse files

Merge pull request #139 from lstoldt/master

Kill all processes under JRuby/Windows
  • Loading branch information...
2 parents 94265c6 + 0606ae8 commit 5119287ae9550867ff66012936d228be4cb5a24c @timcharper timcharper committed Nov 8, 2011
Showing with 11 additions and 7 deletions.
  1. +10 −6 lib/spork/run_strategy/magazine.rb
  2. +1 −1 lib/spork/server.rb
View
16 lib/spork/run_strategy/magazine.rb
@@ -106,22 +106,26 @@ def run(argv, stderr, stdout)
def restart_slave(id)
pid = @pids[id]
- Process.kill(9, pid)
+ kill_slave(pid)
start_slave(id)
end
def windows?
ENV['OS'] == 'Windows_NT'
end
+
+ def kill_slave(pid)
+ if windows?
+ system("taskkill /f /t /pid #{pid} > nul")
+ else
+ Process.kill(9, pid)
+ end
+ end
def kill_all_processes
@pids.each {|pid|
- if windows?
- system("taskkill /f /pid #{pid}")
- else
- Process.kill(9, pid)
- end
+ kill_slave(pid)
}
puts "\nKilling processes."; $stdout.flush
end
View
2 lib/spork/server.rb
@@ -66,8 +66,8 @@ def restart
def sig_int_received
stdout.puts "\n"
+ abort
if run_strategy.running?
- abort
stderr.puts "Running tests stopped. Press CTRL-C again to stop the server."
stderr.flush
else

0 comments on commit 5119287

Please sign in to comment.