supybot-plugin-doc: Fix exceptions raised while exiting the script.

This commit is contained in:
Valentin Lorentz 2021-12-04 03:08:09 +01:00
parent 828fff9cc0
commit 2d2241787f

View File

@ -35,6 +35,7 @@ import os
import sys
import shutil
import string
import logging
import supybot
@ -340,6 +341,10 @@ if __name__ == '__main__':
genDoc(Plugin, options)
if options.clean:
# We are about to remove the log dir; so trying to write anything
# (such as "Shutdown initiated." and friends, from atexit callbacks)
# would result in errors.
log._handler.setLevel(logging.CRITICAL)
shutil.rmtree(conf.supybot.directories.log())
shutil.rmtree(conf.supybot.directories.conf())
shutil.rmtree(conf.supybot.directories.data())