From beda62448dc544ae7969b31a1524fed28e4d2e1f Mon Sep 17 00:00:00 2001 From: Ola x Nilsson Date: Mon, 21 Oct 2019 11:07:04 +0200 Subject: bitbake: bitbake: prserv/serv: Use with while reading pidfile (Bitbake rev: 405a9068ce5072050b9878f7cec15b2c2592bc4e) Signed-off-by: Ola x Nilsson Signed-off-by: Richard Purdie --- bitbake/lib/prserv/serv.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'bitbake') 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 -- cgit v1.2.3-54-g00ecf