mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
#1131: try to make grapviz invocation more robust
This commit is contained in:
parent
6feb07951e
commit
34c8a68e74
@ -164,20 +164,13 @@ def render_dot(self, code, options, format, prefix='graphviz'):
|
||||
self.builder.config.graphviz_dot)
|
||||
self.builder._graphviz_warned_dot = True
|
||||
return None, None
|
||||
wentWrong = False
|
||||
try:
|
||||
# Graphviz may close standard input when an error occurs,
|
||||
# resulting in a broken pipe on communicate()
|
||||
stdout, stderr = p.communicate(code)
|
||||
except (OSError, IOError), err:
|
||||
if err.errno != EPIPE:
|
||||
if err.errno not in (EPIPE, EINVAL):
|
||||
raise
|
||||
wentWrong = True
|
||||
except IOError, err:
|
||||
if err.errno != EINVAL:
|
||||
raise
|
||||
wentWrong = True
|
||||
if wentWrong:
|
||||
# in this case, read the standard output and standard error streams
|
||||
# directly, to get the error message(s)
|
||||
stdout, stderr = p.stdout.read(), p.stderr.read()
|
||||
|
Loading…
Reference in New Issue
Block a user