Open rffontenelle opened 1 month ago
What about:
sphinx-lint > file
status=$?
cat file
exit $status
?
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
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 usingtee
(to get both console and log) I won't get my Shell script to quit after the error status whenset -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.