summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/prserv
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/prserv
parent4bedd3c452991a5f2b22bbae7c2e3185eabca745 (diff)
downloadpoky-beda62448dc544ae7969b31a1524fed28e4d2e1f.tar.gz
poky-beda62448dc544ae7969b31a1524fed28e4d2e1f.tar.bz2
poky-beda62448dc544ae7969b31a1524fed28e4d2e1f.zip
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/prserv')
-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):
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