22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/msword.rb', line 22
def self.process args
java_options = args.delete(:java_options) || "-Dfile.encoding=utf8 -Xms512m -Xmx512m -XX:MaxPermSize=256m"
jar_path = File.join(File.dirname(__FILE__), "msword.jar")
puts MultiJson.encode(args)
Open3.popen3("java #{java_options} -jar #{jar_path}") do |stdin, stdout, stderr, wait_thr|
stdin.write MultiJson.encode(args)
stdin.close
exit_status = wait_thr.value
if exit_status != 0
puts stdout.read
puts stderr.read
end
end
end
|