From 4368c4c04268f6528eb8bcc1ff83ee679f6f13bf Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Thu, 27 Jun 2019 13:16:51 +0100 Subject: attempt to make monkeyfarmer process exit detection more reliable --- test/monkeyfarmer.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/monkeyfarmer.py b/test/monkeyfarmer.py index b86372136..94943431b 100644 --- a/test/monkeyfarmer.py +++ b/test/monkeyfarmer.py @@ -64,18 +64,18 @@ class MonkeyFarmer(asyncore.dispatcher): def handle_close(self): # the pipe to the monkey process has closed - # ensure the child process is finished and report the exit self.close() - if self.monkey.poll() is None: - self.monkey.terminate() - self.monkey.wait() - self.lines.insert(0, "GENERIC EXIT {}".format(self.monkey.returncode).encode('utf-8')) def handle_read(self): got = self.recv(8192) if not got: self.deadmonkey = True + # ensure the child process is finished and report the exit + if self.monkey.poll() is None: + self.monkey.terminate() + self.monkey.wait() + self.lines.insert(0, "GENERIC EXIT {}".format(self.monkey.returncode).encode('utf-8')) return self.incoming += got if b"\n" in self.incoming: -- cgit v1.2.3