Permalink
Browse files

Quick and dirty improvements to detect ruby executable path.

  • Loading branch information...
1 parent 1eecc5e commit 44ef55687f9c44fc47b39133cb614b78619f5056 @jmstacey committed Jul 26, 2010
Showing with 5 additions and 4 deletions.
  1. +5 −4 jprime_worker_launcher.rb
@@ -5,18 +5,19 @@
# Copyright:: Copyright (c) 2010 Jon Stacey
# License:: Distributes under the same terms as Ruby
-ruby_path = `which ruby1.9`
+# Determine ruby path
+ruby_path = ENV["_"]
+# Determine operating system and CPU count
if RUBY_PLATFORM.downcase.include?("darwin")
cpu_count = `hwprefs cpu_count`
elsif RUBY_PLATFORM.downcase.include?("linux")
cpu_count = `cat /proc/cpuinfo | grep processor | wc -l`
end
-
cpu_count = Integer(cpu_count)
-
+
cpu_count.times do |i|
- pid = fork { system "#{ruby_path} jprime_client_worker.rb" }
+ pid = fork { system "#{ruby_path} jprime_worker.rb" }
Process.detach(pid)
puts "Process #{i + 1} started."

0 comments on commit 44ef556

Please sign in to comment.