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": with open('/dev/null', 'r') as si: os.dup2(si.fileno(), sys.stdin.fileno()) -so = open(logfile, 'a+') -os.dup2(so.fileno(), sys.stdout.fileno()) -os.dup2(so.fileno(), sys.stderr.fileno()) +with open(logfile, 'a+') as so: + os.dup2(so.fileno(), sys.stdout.fileno()) + os.dup2(so.fileno(), sys.stderr.fileno()) # Have stdout and stderr be the same so log output matches chronologically # and there aren't two seperate buffers