Simply shutdown logging instead of cleaning up

This commit is contained in:
Pradyun Gedam 2018-06-26 15:23:19 +05:30
parent e7b7239be3
commit 036e5c8eec
No known key found for this signature in database
GPG Key ID: DA17C4B29CB32E4B
1 changed files with 3 additions and 6 deletions

View File

@ -137,8 +137,6 @@ class Command(object):
)
sys.exit(VIRTUALENV_NOT_FOUND)
original_root_handlers = set(logging.root.handlers)
try:
status = self.run(options, args)
# FIXME: all commands should return an exit status
@ -178,10 +176,9 @@ class Command(object):
retries=0,
timeout=min(5, options.timeout)) as session:
pip_version_check(session, options)
# Avoid leaking loggers
for handler in set(logging.root.handlers) - original_root_handlers:
# this method benefit from the Logger class internal lock
logging.root.removeHandler(handler)
# Shutdown the logging module
logging.shutdown()
return SUCCESS