bitbake: bitbake: prserv/serv: Use with while reading pidfile

(Bitbake rev: 405a9068ce5072050b9878f7cec15b2c2592bc4e)

Signed-off-by: Ola x Nilsson <olani@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Ola x Nilsson
2019-10-21 11:07:04 +02:00
committed by Richard Purdie
parent 4bedd3c452
commit beda62448d

View File

@@ -379,9 +379,8 @@ def stop_daemon(host, port):
ip = socket.gethostbyname(host)
pidfile = PIDPREFIX % (ip, port)
try:
pf = open(pidfile,'r')
pid = int(pf.readline().strip())
pf.close()
with open(pidfile) as pf:
pid = int(pf.readline().strip())
except IOError:
pid = None