Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

progress and raise_on_all_errors options incompatible #1043

Open
alexandre184 opened this issue Nov 29, 2022 · 2 comments
Open

progress and raise_on_all_errors options incompatible #1043

alexandre184 opened this issue Nov 29, 2022 · 2 comments

Comments

@alexandre184
Copy link

Issue description

When both option are enabled, there is an exception because err is nil.

raise "Error generating PDF\n Command Error: #{err}" if options[:raise_on_all_errors] && !err.empty?

But because wkhtmltopdf output on stderr, it's maybe useless to have both options enabled at the same time.
And even if it was not the case, PTY.spawn does not differentiate stdin from stderr

Expected or desired behavior

Definitely not a big problem, I don't know what could be a good behavior. I let you choose what to do with that !

System specifications

not needed

@unixmonkey
Copy link
Collaborator

This has come up before in #861

This is a bit of a gotcha with wkhtmltopdf, which by default writes it's output to stderr, even when there is no error.

This is stated as by design here (because it can output the PDF on stdout): wkhtmltopdf/wkhtmltopdf#1980

You can change this by specifying the log_level: 'error' option, which was introduced here: #834

This should change it so that it only outputs to stderr on actual errors. However, I wonder if this should be the default since we always output a tempfile in this project.

Try adding that to your config and see if that helps for your situation.

@alexandre184
Copy link
Author

Thanks for the quick reply.
It's not identical to 861. Sorry maybe I should have mentioned that.
There is an actual exception on the line I linked in the description when both option are enabled, independently of wkhtmltopdf.
The rest of the description is more an observation about the usefulness of the two options at the same time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants