diff --git a/sphinx/ext/graphviz.py b/sphinx/ext/graphviz.py index a26e34fd5..800e9ca80 100644 --- a/sphinx/ext/graphviz.py +++ b/sphinx/ext/graphviz.py @@ -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()