Skip to content

Commit

Permalink
Improve traceback messages in parallel builds (#11452)
Browse files Browse the repository at this point in the history
  • Loading branch information
picnixz committed Jul 23, 2023
1 parent ae866b1 commit 1cb52d5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
4 changes: 3 additions & 1 deletion CHANGES
Expand Up @@ -18,7 +18,6 @@ Deprecated
Features added
--------------

* #11157: Keep ``translated: True`` attribute on translated nodes.
* #11415: Add a checksum to JavaScript and CSS asset URIs included within
generated HTML, using the CRC32 algorithm.
* :meth:`~sphinx.application.Sphinx.require_sphinx` now allows the version
Expand All @@ -32,6 +31,9 @@ Features added
Patch by Thomas Louf, Adam Turner, and Jean-François B.
* #10983: Support for multiline copyright statements in the footer block.
Patch by Stefanie Molin
* #11157: Keep the ``translated`` attribute on translated nodes.
* #11451: Improve the traceback displayed when using :option:`sphinx-build -T`
in parallel builds. Patch by Bénédikt Tran

Bugs fixed
----------
Expand Down
11 changes: 8 additions & 3 deletions sphinx/cmd/build.py
Expand Up @@ -18,7 +18,7 @@
import sphinx.locale
from sphinx import __display_version__
from sphinx.application import Sphinx
from sphinx.errors import SphinxError
from sphinx.errors import SphinxError, SphinxParallelError
from sphinx.locale import __
from sphinx.util import Tee
from sphinx.util.console import color_terminal, nocolor, red, terminal_safe # type: ignore
Expand All @@ -41,8 +41,13 @@ def handle_exception(
else:
print(file=stderr)
if args.verbosity or args.traceback:
traceback.print_exc(None, stderr)
print(file=stderr)
exc = sys.exc_info()[1]
if isinstance(exc, SphinxParallelError):
exc_format = '(Error in parallel process)\n' + exc.traceback
print(exc_format, file=stderr)
else:
traceback.print_exc(None, stderr)
print(file=stderr)
if isinstance(exception, KeyboardInterrupt):
print(__('Interrupted!'), file=stderr)
elif isinstance(exception, SystemMessage):
Expand Down

0 comments on commit 1cb52d5

Please sign in to comment.