summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bitbake/lib/bb/msg.py11
-rw-r--r--bitbake/lib/bb/ui/knotty.py2
2 files changed, 13 insertions, 0 deletions
diff --git a/bitbake/lib/bb/msg.py b/bitbake/lib/bb/msg.py
index 6259af037f..05645739d4 100644
--- a/bitbake/lib/bb/msg.py
+++ b/bitbake/lib/bb/msg.py
@@ -320,3 +320,14 @@ def setLoggingConfig(defaultconfig, userconfigfile=None):
320 # TODO: I don't think that setting the global log level should be necessary 320 # TODO: I don't think that setting the global log level should be necessary
321 #if newlevel < bb.msg.loggerDefaultLogLevel: 321 #if newlevel < bb.msg.loggerDefaultLogLevel:
322 # bb.msg.loggerDefaultLogLevel = newlevel 322 # bb.msg.loggerDefaultLogLevel = newlevel
323
324def cleanupLogging():
325 # Iterate through all the handlers and close them if possible. Fixes
326 # 'Unclosed resource' warnings when bitbake exits, see
327 # https://bugs.python.org/issue23010
328 handlers = set()
329 for logger_iter in logging.Logger.manager.loggerDict.keys():
330 handlers.update(logging.getLogger(logger_iter).handlers)
331
332 for h in handlers:
333 h.close()
diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py
index 386f27876d..695108a646 100644
--- a/bitbake/lib/bb/ui/knotty.py
+++ b/bitbake/lib/bb/ui/knotty.py
@@ -823,4 +823,6 @@ def main(server, eventHandler, params, tf = TerminalFilter):
823 if e.errno == errno.EPIPE: 823 if e.errno == errno.EPIPE:
824 pass 824 pass
825 825
826 bb.msg.cleanupLogging()
827
826 return return_value 828 return return_value