summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
authorOla x Nilsson <ola.x.nilsson@axis.com>2019-10-21 11:07:04 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-10-28 05:31:53 +0000
commitbeda62448dc544ae7969b31a1524fed28e4d2e1f (patch)
treee34d481b774ccb7957ff996ccb6899529c1c8d14 /bitbake/lib
parent4bedd3c452991a5f2b22bbae7c2e3185eabca745 (diff)
downloadpoky-beda62448dc544ae7969b31a1524fed28e4d2e1f.tar.gz
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>
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/prserv/serv.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/bitbake/lib/prserv/serv.py b/bitbake/lib/prserv/serv.py
index be3acec36a..2bc68904f3 100644
--- a/bitbake/lib/prserv/serv.py
+++ b/bitbake/lib/prserv/serv.py
@@ -379,9 +379,8 @@ def stop_daemon(host, port):
379 ip = socket.gethostbyname(host) 379 ip = socket.gethostbyname(host)
380 pidfile = PIDPREFIX % (ip, port) 380 pidfile = PIDPREFIX % (ip, port)
381 try: 381 try:
382 pf = open(pidfile,'r') 382 with open(pidfile) as pf:
383 pid = int(pf.readline().strip()) 383 pid = int(pf.readline().strip())
384 pf.close()
385 except IOError: 384 except IOError:
386 pid = None 385 pid = None
387 386