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

[feature request] Add option to store output in file as well #125

Open
rffontenelle opened this issue Oct 22, 2024 · 2 comments
Open

[feature request] Add option to store output in file as well #125

rffontenelle opened this issue Oct 22, 2024 · 2 comments

Comments

@rffontenelle
Copy link
Contributor

rffontenelle commented Oct 22, 2024

When running sphinx-lint in CI environment, I'd like to have the syntax issues to be both printed to the output and stored in a log file, because the output will be annotated with sphinx-lint-problem-matcher in the GitHub Actions output, and the log file will be upload as an artifact to notify outside GitHub.

In this scenario, If I simply redirect sphinx-lint > file I get no output, if I redirect using tee (to get both console and log) I won't get my Shell script to quit after the error status when set -e (If I set -o pipefail, tee wouldn't be run as sphinx-lint would exit with error before).

Taking Sphinx as example, its -w flag store warnings in log file but still print to output.

@JulienPalard
Copy link
Collaborator

What about:

sphinx-lint > file
status=$?
cat file
exit $status

?

@rffontenelle
Copy link
Contributor Author

rffontenelle commented Oct 24, 2024

If set -e (exit on error), it will quit after the first line. Surely this flag can be unset temporarily, but then it would mask other issues like e.g. sphinx-lint accidentally being not installed in a CI environment.

Today sphinx-lint already print syntax errors to stdout and exit with 1 when there syntax errors. With this other feature (flag to save to file as well), no other lines would be necessary to save the synax errors to a file as well.

By the way, sphinx-lint 2> logfile would be the correct redirect since my PR for sending errors to stderr

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