Skip to content

Commit

Permalink
Silence Prince message fin|success
Browse files Browse the repository at this point in the history
Prince outputs `fin|success` to `err`. This change sends the `err` to
the `log_file`.
  • Loading branch information
repinel committed Nov 22, 2019
1 parent 559f374 commit 49d2e2c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion lib/princely/pdf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,11 @@ def initialize_pdf_from_string(string, output_file, options = {})

log_command path if options[:log_command]

# Make sure the log file exists before the pipe creation.
FileUtils.touch log_file

# Actually call the prince command, and pass the entire data stream back.
pdf = IO.popen(path, "w+")
pdf = IO.popen(path, "w+", err: log_file.to_s)
pdf.puts string
pdf
end
Expand Down
2 changes: 1 addition & 1 deletion spec/princely/pdf_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
end

it "generates a PDF from HTML" do
pdf = Princely::Pdf.new.pdf_from_string html_doc
pdf = Princely::Pdf.new(log_file: "/tmp/test_log").pdf_from_string html_doc
expect(pdf).to start_with("%PDF-1.4")
expect(pdf.rstrip).to end_with("%%EOF")
pdf.length > 100
Expand Down

0 comments on commit 49d2e2c

Please sign in to comment.