Skip to content

Commit

Permalink
Improve traceback message in parallel build (sphinx-doc#11451)
Browse files Browse the repository at this point in the history
  • Loading branch information
picnixz committed Jun 4, 2023
1 parent d3c91f9 commit 69a777f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGES
Expand Up @@ -18,6 +18,8 @@ Deprecated
Features added
--------------

* #11451: Improve the traceback displayed when using :option:`-T` in parallel
builds. Patch by Bénédikt Tran
* #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 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_info = sys.exc_info()
if isinstance(exc_info[1], SphinxParallelError):
exc_format = '(Error in parallel process)\n' + exc_info[1].traceback
print(exc_format, file=stderr)
else:
traceback.print_exception(*exc_info, limit=None, file=stderr, chain=True)
print(file=stderr)
if isinstance(exception, KeyboardInterrupt):
print(__('Interrupted!'), file=stderr)
elif isinstance(exception, SystemMessage):
Expand Down

0 comments on commit 69a777f

Please sign in to comment.