forked from bcotton/selenium-grid
-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathvm.rb
More file actions
35 lines (28 loc) · 932 Bytes
/
vm.rb
File metadata and controls
35 lines (28 loc) · 932 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
module Java
class VM
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 << "&"
command << " echo $! > #{options[:pid_file]}" if options[:pid_file]
command.unshift("nohup")
end
else
command << "; echo $! > #{options[:pid_file]}" if options[:pid_file]
end
sh command.join(' ')
end
def jvm_properties(property_hash)
return "" unless property_hash
property_hash.inject([]) {|memo, (name, value)| memo << "-D#{name}=#{value}" }.join(' ')
end
end
end