20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/libis/format/tool/pdf_metadata.rb', line 20
def run(source, target, options = [])
if OS.java?
end
timeout = Libis::Format::Config[:timeouts][:pdf_copy]
result = Libis::Tools::Command.run(
Libis::Format::Config[:java_cmd],
'-jar', Libis::Format::Config[:pdf_tool],
'metadata',
'-i', source,
'-o', target,
*options,
timeout: timeout,
kill_after: timeout * 2
)
raise RuntimeError, "#{self.class} took too long (> #{timeout} seconds) to complete" if result[:timeout]
raise RuntimeError, "#{self.class} errors: #{result[:err].join("\n")}" unless result[:status] == 0 && result[:err].empty?
result
end
|