summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2017-11-08 14:04:50 +0000
committerArmin Kuster <akuster808@gmail.com>2017-11-09 12:47:32 -0800
commit48d422716c3f7dec66c05512735122ed8baed887 (patch)
tree06c8d1ff9f46bb743b9ab2551af570a8febd6b08
parent555f46994e20faa59d19877961e80eea6e37459f (diff)
downloadbitbake-contrib-stable/1.36-next.tar.gz
bitbake-contrib-stable/1.36-next.tar.bz2
bitbake-contrib-stable/1.36-next.zip
tinfoil: Ensure we clean up loggersstable/1.36-next
This is primarily paranoid but ensure we remove any loggers we setup either directly or indirectly so the initial state is restored after we exit. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit af7d63b1f76fd3f7fa92ed15ae61ca47d9e13472) Signed-off-by: Armin Kuster <akuster808@gmail.com>
-rw-r--r--lib/bb/tinfoil.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/bb/tinfoil.py b/lib/bb/tinfoil.py
index fb2ee4ad9c..fa95f6329f 100644
--- a/lib/bb/tinfoil.py
+++ b/lib/bb/tinfoil.py
@@ -322,14 +322,14 @@ class Tinfoil:
self.server_connection = None
self.recipes_parsed = False
self.quiet = 0
+ self.oldhandlers = self.logger.handlers[:]
if setup_logging:
# This is the *client-side* logger, nothing to do with
# logging messages from the server
- oldhandlers = self.logger.handlers[:]
bb.msg.logger_create('BitBake', output)
self.localhandlers = []
for handler in self.logger.handlers:
- if handler not in oldhandlers:
+ if handler not in self.oldhandlers:
self.localhandlers.append(handler)
def __enter__(self):
@@ -835,6 +835,12 @@ class Tinfoil:
self.server_connection.terminate()
self.server_connection = None
+ # Restore logging handlers to how it looked when we started
+ if self.oldhandlers:
+ for handler in self.logger.handlers:
+ if handler not in self.oldhandlers:
+ self.logger.handlers.remove(handler)
+
def _reconvert_type(self, obj, origtypename):
"""
Convert an object back to the right type, in the case