Commit 4ea3e7be authored by Julien Muchembled's avatar Julien Muchembled

Do not send TERM signal to a process that has already been waited on

parent f3a69c98
......@@ -86,8 +86,8 @@ class Connection(object):
def close(self):
try:
self.process.stop()
except (AttributeError, OSError):
pass # we already polled an exited process
except AttributeError:
pass
def refresh(self):
# Check that the connection is alive
......
......@@ -156,10 +156,11 @@ class Popen(subprocess.Popen):
self.returncode = -1
def stop(self):
if self.pid:
if self.pid and self.returncode is None:
self.terminate()
t = threading.Timer(5, self.kill)
t.start()
# PY3: use waitid(WNOWAIT) and call self.poll() after t.cancel()
r = self.wait()
t.cancel()
return r
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment