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

Incorrect stdout / stderr use #503

Closed
anghenfil opened this issue Aug 13, 2024 · 1 comment
Closed

Incorrect stdout / stderr use #503

anghenfil opened this issue Aug 13, 2024 · 1 comment

Comments

@anghenfil
Copy link

Hey,

currently vivliostyle-cli logs to stderr, even if the built was successfully:

stdout: "\ndata/main.pdf has been created.\n"

stderr: "- Collecting build config\nℹ Launching build environment\n(node:13) [DEP0040] DeprecationWarning: The punycodemodule is deprecated. Please use a userland alternative instead.\n(Usenode --trace-deprecation ... to show where the warning was created)\nℹ Building pages\nℹ Building PDF\nℹ Processing PDF\n🎉 Built successfully.\n"

It would be nice to only use stderr on failed builts, so that the vivliostyle-cli output can be parsed more easily.

Thanks!
anghenfil

@spring-raining
Copy link
Member

Hi @anghenfil,
I found an option in the stream library used by vivliostyle-cli that can change this behavior. Adjusting this setting will resolve the issue. https://github.com/sindresorhus/ora?tab=readme-ov-file#stream

However, it is doubtful whether this setting should be used. The author of this library intentionally chose stderr as the default setting.

sindresorhus/ora#85
The reason it's stderr is so that it will not interfere with normal output. Most other spinners use stderr too.

Despite its name, stderr is sometimes used for diagnostic messages like build progress, not just error messages. In my personal opinion, it is preferable to follow convention and use stderr. If you find the output annoying, please consider using the --log-level silent option.

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