1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-30 00:20:08 +00:00

bitbake: daemonize/build: Clean up /dev/null fd handling

At the end of bitbake selftest we see:

sys:1: ResourceWarning: unclosed file <_io.TextIOWrapper name='/dev/null' mode='r+' encoding='UTF-8'>

Clean up the /dev/null handling to drop the unused entry in build.by and
ensure the other open() calls are cleaned up.

NULL was unused since http://git.yoctoproject.org/cgit.cgi/poky/commit/bitbake/lib/bb/build.py?id=4a081b5a52e3d27da8d4b062f3fda292e8d8fb0a
back in 2012.

(Bitbake rev: e72be96cfa9f05fda5f420c7cfa8bcfa9304b884)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie
2018-09-21 20:14:03 -07:00
parent 7be6abc98d
commit c942230eee
2 changed files with 4 additions and 7 deletions
+2 -2
View File
@@ -65,8 +65,8 @@ def createDaemon(function, logfile):
# The second child.
# Replace standard fds with our own
si = open('/dev/null', 'r')
os.dup2(si.fileno(), sys.stdin.fileno())
with open('/dev/null', 'r') as si:
os.dup2(si.fileno(), sys.stdin.fileno())
try:
so = open(logfile, 'a+')