Created
June 24, 2011 09:15
-
-
Save noniq/1044475 to your computer and use it in GitHub Desktop.
Patch trying to make akephalos kill its remote process correctly on windows
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/akephalos.gemspec b/akephalos.gemspec | |
index 1eee36a..ffbc980 100644 | |
--- a/akephalos.gemspec | |
+++ b/akephalos.gemspec | |
@@ -22,6 +22,9 @@ Gem::Specification.new do |s| | |
if RUBY_PLATFORM != "java" && ENV["PLATFORM"] != "java" | |
s.add_runtime_dependency "jruby-jars" | |
end | |
+ if RUBY_PLATFORM =~ /mingw32/ | |
+ s.add_runtime_dependency "win32-process" | |
+ end | |
s.add_development_dependency "sinatra" | |
s.add_development_dependency "rspec", ">= 2.3.0" | |
diff --git a/lib/akephalos/remote_client.rb b/lib/akephalos/remote_client.rb | |
index e36c0bb..8d8a8c3 100644 | |
--- a/lib/akephalos/remote_client.rb | |
+++ b/lib/akephalos/remote_client.rb | |
@@ -61,7 +61,15 @@ module Akephalos | |
# Ensure that the remote server shuts down gracefully when we are | |
# finished. | |
- at_exit { Process.kill(:INT, remote_client.pid) } | |
+ at_exit { | |
+ if RUBY_PLATFORM =~ /mingw32/ | |
+ # FIXME: This is an ugly hack - but requiring win32/process sooner seems to cause troubles with DRb ... | |
+ require 'win32/process' | |
+ Process.kill(1, remote_client.pid) | |
+ else | |
+ Process.kill(:INT, remote_client.pid) | |
+ end | |
+ } | |
port | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment