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

Implement capture_stderr C-API option #2862

Closed
wants to merge 2 commits into from

Conversation

mgreter
Copy link
Contributor

@mgreter mgreter commented Apr 8, 2019

As an embeddable library we should try to play nice with
our parents resources. It is therefore desirable to have
a way to capture messages on stderr. This makes it easier
and safer to use libsass in eg. threaded environments.

Core errors (mainly memory allocation problems) and
dev/debug data is still printed to stderr directly.

Introduces two new functions to the C-API:

  • sass_option_set_suppress_stderr
  • sass_context_get_stderr_string

As an embeddable library we should try to play nice with
our parents resources. It is therefore desirable to have
a way to capture messages on stderr. This makes it easier
and safer to use libsass in eg. threaded environments.

Core errors (mainly memory allocation problems) and
dev/debug data is still printed to stderr directly.
@mgreter mgreter force-pushed the feature/capture-stderr branch from 4f8bdd2 to 071eebe Compare April 8, 2019 00:53
@xmo-odoo
Copy link

Alternate option providing more flexibility for the caller: a warnings callback, which would default to printing the message to stderr?

@mgreter
Copy link
Contributor Author

mgreter commented May 20, 2021

Thx @xmo-odoo, that is certainly something I wouldn't be opposed to. Ongoing LibSass 4.0 branch (#3135) already fixes the issue by never directly writing to stderr/stdout if not explicitly requested to. But that branch also complicated error reporting a little by introducing (all optional) ANSI colors, Unicode and line wrapping in the output. Going to close this here as work in this area will certainly not land in any pre 4.0 release.

@mgreter mgreter closed this May 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants