[oe-commits] [bitbake] 10/13: bitbake: prserv/serv: Use with while reading pidfile

git at git.openembedded.org git at git.openembedded.org
Wed Oct 23 22:00:14 UTC 2019


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository bitbake.

commit 405a9068ce5072050b9878f7cec15b2c2592bc4e
Author: Ola x Nilsson <ola.x.nilsson at axis.com>
AuthorDate: Mon Oct 21 11:07:04 2019 +0200

    bitbake: prserv/serv: Use with while reading pidfile
    
    Signed-off-by: Ola x Nilsson <olani at axis.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 lib/prserv/serv.py | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/lib/prserv/serv.py b/lib/prserv/serv.py
index be3acec..2bc6890 100644
--- a/lib/prserv/serv.py
+++ b/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
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list