diff options
Diffstat (limited to 'poky/bitbake/lib/prserv/serv.py')
-rw-r--r-- | poky/bitbake/lib/prserv/serv.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/poky/bitbake/lib/prserv/serv.py b/poky/bitbake/lib/prserv/serv.py index be3acec36..b854ba14b 100644 --- a/poky/bitbake/lib/prserv/serv.py +++ b/poky/bitbake/lib/prserv/serv.py @@ -243,6 +243,7 @@ class PRServer(SimpleXMLRPCServer): try: pid = os.fork() if pid > 0: + self.socket.close() # avoid ResourceWarning in parent return pid except OSError as e: raise Exception("%s [%d]" % (e.strerror, e.errno)) @@ -379,9 +380,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 |