Class: Java::VM

Inherits:
Object
  • Object
show all
Defined in:
lib/selenium-grid/lib/ruby/java/vm.rb

Instance Method Summary collapse

Instance Method Details

#jvm_properties(property_hash) ⇒ Object



24
25
26
27
# File 'lib/selenium-grid/lib/ruby/java/vm.rb', line 24

def jvm_properties(property_hash)
  return "" unless property_hash
  property_hash.inject([]) {|memo, (name, value)| memo << "-D#{name}=#{value}" }.join(' ')
end

#run(classname, options) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/selenium-grid/lib/ruby/java/vm.rb', line 5

def run(classname, options)
  command = [ "java" ]
  command << "-cp \"#{options[:classpath]}\""
  command << classname
  command << jvm_properties(options[:properties])
  command << options[:args].join(' ') if options[:args]
  command << ">\"#{options[:log_file]}\" 2>&1" if options[:log_file]

  if options[:background]
    if PLATFORM['win32']
      command.unshift("start")
    else
      command << "&"
    end
  end

  sh command.join(' ')
end