lib/libreconv.rb in libreconv-0.8.0 vs lib/libreconv.rb in libreconv-0.8.1
- old
+ new
@@ -25,12 +25,14 @@
raise IOError, "Can't find Libreoffice or Openoffice executable."
end
end
def convert
- cmd = "#{@soffice_command} --headless --convert-to pdf #{@source} -outdir #{@target_path}"
- pid = Spoon.spawnp(@soffice_command, "--headless", "--convert-to", "pdf", @source, "-outdir", @target_path, ">", "/dev/null")
+ orig_stdout = $stdout.clone
+ $stdout.reopen File.new('/dev/null', 'w')
+ pid = Spoon.spawnp(@soffice_command, "--headless", "--convert-to", "pdf", @source, "-outdir", @target_path)
Process.waitpid(pid)
+ $stdout.reopen orig_stdout
target_tmp_file = "#{@target_path}/#{File.basename(@source, ".*")}.pdf"
FileUtils.cp target_tmp_file, @target
end
private
\ No newline at end of file