mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix #10110: sphinx-build: Emit builder-finished before shutdown
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.
This commit is contained in:
3
CHANGES
3
CHANGES
@@ -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
|
||||
--------
|
||||
|
||||
|
||||
@@ -328,6 +328,15 @@ class Sphinx:
|
||||
self.builder.compile_update_catalogs()
|
||||
self.builder.build_update()
|
||||
|
||||
self.events.emit('build-finished', None)
|
||||
except Exception as err:
|
||||
# delete the saved env to force a fresh build next time
|
||||
envfile = path.join(self.doctreedir, ENV_PICKLE_FILENAME)
|
||||
if path.isfile(envfile):
|
||||
os.unlink(envfile)
|
||||
self.events.emit('build-finished', err)
|
||||
raise
|
||||
|
||||
if self._warncount and self.keep_going:
|
||||
self.statuscode = 1
|
||||
|
||||
@@ -355,15 +364,7 @@ class Sphinx:
|
||||
'outdir': relpath(self.outdir),
|
||||
'project': self.config.project
|
||||
})
|
||||
except Exception as err:
|
||||
# delete the saved env to force a fresh build next time
|
||||
envfile = path.join(self.doctreedir, ENV_PICKLE_FILENAME)
|
||||
if path.isfile(envfile):
|
||||
os.unlink(envfile)
|
||||
self.events.emit('build-finished', err)
|
||||
raise
|
||||
else:
|
||||
self.events.emit('build-finished', None)
|
||||
|
||||
self.builder.cleanup()
|
||||
|
||||
# ---- general extensibility interface -------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user