diff options
| author | Chris Laplante <chris.laplante@agilent.com> | 2024-10-08 13:03:14 -0400 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-10-11 12:17:36 +0100 |
| commit | 0f83df527d6cac2a1eae7fc011ece1fb05daf2a0 (patch) | |
| tree | d4f6235fab6ea780663137e93fa79c17a37260f1 | |
| parent | 331270628c58b4cfce788c599eed608e46607c75 (diff) | |
| download | poky-0f83df527d6cac2a1eae7fc011ece1fb05daf2a0.tar.gz | |
bitbake: bitbake-server: use with to avoid ResourceWarning
Prevents the following warning in bitbake-cookerdaemon.log:
2386729 10:54:16.195427 Exiting (socket: True)
2386729 10:54:16.201065 Exiting as we could obtain the lock
sys:1: ResourceWarning: unclosed file <_io.TextIOWrapper name='/home/laplante/main_yocto/build/bitbake-cookerdaemon.log' mode='a+' encoding='UTF-8'>
(Bitbake rev: 8dbf1ec8139d9dd7f52c1773cccbe7696b3ec1b4)
Signed-off-by: Chris Laplante <chris.laplante@agilent.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rwxr-xr-x | bitbake/bin/bitbake-server | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/bitbake/bin/bitbake-server b/bitbake/bin/bitbake-server index 454a3919aa..e367ec2c12 100755 --- a/bitbake/bin/bitbake-server +++ b/bitbake/bin/bitbake-server | |||
| @@ -38,9 +38,9 @@ if xmlrpcinterface[0] == "None": | |||
| 38 | with open('/dev/null', 'r') as si: | 38 | with open('/dev/null', 'r') as si: |
| 39 | os.dup2(si.fileno(), sys.stdin.fileno()) | 39 | os.dup2(si.fileno(), sys.stdin.fileno()) |
| 40 | 40 | ||
| 41 | so = open(logfile, 'a+') | 41 | with open(logfile, 'a+') as so: |
| 42 | os.dup2(so.fileno(), sys.stdout.fileno()) | 42 | os.dup2(so.fileno(), sys.stdout.fileno()) |
| 43 | os.dup2(so.fileno(), sys.stderr.fileno()) | 43 | os.dup2(so.fileno(), sys.stderr.fileno()) |
| 44 | 44 | ||
| 45 | # Have stdout and stderr be the same so log output matches chronologically | 45 | # Have stdout and stderr be the same so log output matches chronologically |
| 46 | # and there aren't two seperate buffers | 46 | # and there aren't two seperate buffers |
