Skip to content
This repository

Kill all processes under JRuby/Windows #139

Merged
merged 1 commit into from over 2 years ago

5 participants

Lelon Stoldt Mikhail Vaysman Philip Arndt Tim Harper kenmgrimm
Lelon Stoldt

I'm noticing that when I run Spork under JRuby 1.6.4(ruby 1.9.2, rails 3.1) it creates a new jruby process every time I run my tests at the cost of about 100mb. In addition, these processes continue to run after I close spork with CTRL-C.

Attached a pull request that I'm currently using but couldn't run tests as they require linecache19 which has extensions which won't build under JRuby.

kenmgrimm

Had the same problem with jruby / windows. Tried this patch and it works great, thanks!

Mikhail Vaysman

This patch help me too. Thanks.

Philip Arndt

Seems like this could be pulled in @timcharper ?

Tim Harper timcharper merged commit 5119287 into from
Tim Harper
Owner

Patch looks good, sorry for the delay, thanks for the nudge. Merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Sep 08, 2011
Lelon Stoldt lstoldt Kill all processes under jruby/windows 0606ae8
This page is out of date. Refresh to see the latest.

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

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.