Skip to content
This repository
Browse code

Merge pull request #139 from lstoldt/master

Kill all processes under JRuby/Windows
  • Loading branch information...
commit 5119287ae9550867ff66012936d228be4cb5a24c 2 parents 94265c6 + 0606ae8
Tim Harper timcharper authored

Showing 2 changed files with 11 additions and 7 deletions. Show diff stats Hide diff stats

  1. +10 6 lib/spork/run_strategy/magazine.rb
  2. +1 1  lib/spork/server.rb
16 lib/spork/run_strategy/magazine.rb
@@ -106,22 +106,26 @@ def run(argv, stderr, stdout)
106 106
107 107 def restart_slave(id)
108 108 pid = @pids[id]
109   - Process.kill(9, pid)
  109 + kill_slave(pid)
110 110 start_slave(id)
111 111 end
112 112
113 113 def windows?
114 114 ENV['OS'] == 'Windows_NT'
115 115 end
  116 +
  117 + def kill_slave(pid)
  118 + if windows?
  119 + system("taskkill /f /t /pid #{pid} > nul")
  120 + else
  121 + Process.kill(9, pid)
  122 + end
  123 + end
116 124
117 125 def kill_all_processes
118 126
119 127 @pids.each {|pid|
120   - if windows?
121   - system("taskkill /f /pid #{pid}")
122   - else
123   - Process.kill(9, pid)
124   - end
  128 + kill_slave(pid)
125 129 }
126 130 puts "\nKilling processes."; $stdout.flush
127 131 end
2  lib/spork/server.rb
@@ -66,8 +66,8 @@ def restart
66 66
67 67 def sig_int_received
68 68 stdout.puts "\n"
  69 + abort
69 70 if run_strategy.running?
70   - abort
71 71 stderr.puts "Running tests stopped. Press CTRL-C again to stop the server."
72 72 stderr.flush
73 73 else

0 comments on commit 5119287

Please sign in to comment.
Something went wrong with that request. Please try again.