>
>  How can I get sphinx-build to set the return code to something other than 
> zero when there are errors or warnings building docs? 


I can't give you a proper fix (I, too, would love this functionality, but I 
don't know to where to submit pull requests so I haven't bothered to look 
into it), but the cruddy workaround I've implemented for our uses is a 
wrapper script:

sphinx_post_processer.py sphinx-build -q html

The code of 'sphinx_post_processer.py' boils down to:

-----
import sys
from subprocess import Popen, PIPE, STDOUT

args = sys.argv[1:]
sphinx = Popen(args, stdout=PIPE, stderr=STDOUT)

  # Note that sphinx_error will be None because of stderr=STDOUT above.
  # All output is combined into sphinx_output.
sphinx_output, sphinx_error = sphinx.communicate()

  # yes, this means that for longer-running builds, this script will appear 
to
  # produce no output, until it will suddenly explode with all the sphinx 
output.
  # i.e. the above .communicate() call buffers it all.
print sphinx_output

if 'error' in sphinx_output.lower():
  raise Exception()
-----

It's a bit more complicated than that (e.g. the "'error' in 
sphinx_output.lower()" is much more involved for our uses), but this is the 
core gist of the script that should work as I've typed above.

Happy workarounding.

Kevin

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-dev" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sphinx-dev/-/Aw24XLiZ09gJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sphinx-dev?hl=en.

Reply via email to