diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-09-21 20:14:03 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-09-22 15:52:12 -0700 |
commit | c942230eee405d35b99d85a3e9d8b00ce11d2222 (patch) | |
tree | 1746accff0c638dfd28899f3a468d5829bb69a34 /bitbake/lib/bb/daemonize.py | |
parent | 7be6abc98d6e78814ac1a94ebb162073671659b8 (diff) | |
download | poky-c942230eee405d35b99d85a3e9d8b00ce11d2222.tar.gz |
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>
Diffstat (limited to 'bitbake/lib/bb/daemonize.py')
-rw-r--r-- | bitbake/lib/bb/daemonize.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/bitbake/lib/bb/daemonize.py b/bitbake/lib/bb/daemonize.py index 613fb35536..c937675eb6 100644 --- a/bitbake/lib/bb/daemonize.py +++ b/bitbake/lib/bb/daemonize.py | |||
@@ -65,8 +65,8 @@ def createDaemon(function, logfile): | |||
65 | # The second child. | 65 | # The second child. |
66 | 66 | ||
67 | # Replace standard fds with our own | 67 | # Replace standard fds with our own |
68 | si = open('/dev/null', 'r') | 68 | with open('/dev/null', 'r') as si: |
69 | os.dup2(si.fileno(), sys.stdin.fileno()) | 69 | os.dup2(si.fileno(), sys.stdin.fileno()) |
70 | 70 | ||
71 | try: | 71 | try: |
72 | so = open(logfile, 'a+') | 72 | so = open(logfile, 'a+') |