Skip to content

Commit

Permalink
Fix sphinx-doc#10110: sphinx-build: Emit builder-finished before shut…
Browse files Browse the repository at this point in the history
…down

The error on the builder-finished event has been ignored for the
calculation of the exit code.  This emits the event earilier step to be
calculated correctly.
  • Loading branch information
tk0miya committed Jan 17, 2022
1 parent bd55cce commit 34bedf9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGES
Expand Up @@ -16,6 +16,9 @@ Features added
Bugs fixed
----------

* #10110: sphinx-build: exit code is not changed when error is raised on
builder-finished event

Testing
--------

Expand Down
4 changes: 2 additions & 2 deletions sphinx/application.py
Expand Up @@ -336,6 +336,8 @@ def build(self, force_all: bool = False, filenames: List[str] = None) -> None:
self.builder.compile_update_catalogs()
self.builder.build_update()

self.events.emit('build-finished', None)

if self._warncount and self.keep_going:
self.statuscode = 1

Expand Down Expand Up @@ -370,8 +372,6 @@ def build(self, force_all: bool = False, filenames: List[str] = None) -> None:
os.unlink(envfile)
self.events.emit('build-finished', err)
raise
else:
self.events.emit('build-finished', None)
self.builder.cleanup()

# ---- general extensibility interface -------------------------------------
Expand Down

0 comments on commit 34bedf9

Please sign in to comment.