]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
knotty: Ensure consolelog file handle is closed
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 11 May 2016 21:55:53 +0000 (22:55 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 12 May 2016 07:21:12 +0000 (08:21 +0100)
If we don't close the console log file handle, python prints a warning
about unclosed file handles upon exit which is annoying.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
lib/bb/ui/knotty.py

index 903d72b56528c8d8ad0e6d05b3649b93b8554dd8..85a71f45ec5add7226dad6b037ccaedd8831a9d1 100644 (file)
@@ -278,6 +278,7 @@ def main(server, eventHandler, params, tf = TerminalFilter):
         server.terminateServer()
         return
 
+    consolelog = None
     if consolelogfile and not params.options.show_environment and not params.options.show_versions:
         bb.utils.mkdirhier(os.path.dirname(consolelogfile))
         conlogformat = bb.msg.BBLogFormatter(format_str)
@@ -591,4 +592,8 @@ def main(server, eventHandler, params, tf = TerminalFilter):
         if e.errno == errno.EPIPE:
             pass
 
+    if consolelog:
+        logger.removeHandler(consolelog)
+        consolelog.close()
+
     return return_value