summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2019-06-06 15:07:52 +0100
committerVincent Sanders <vince@kyllikki.org>2019-06-06 17:17:27 +0100
commit4be18fcf473b5bff57daa1b57e3de961134a546a (patch)
tree73c9c969064dedca581979f4a4cb0c55a02f3a2e
parentf2000ae60efaf8f296dd4e2719417224cd99ac59 (diff)
downloadnetsurf-4be18fcf473b5bff57daa1b57e3de961134a546a.tar.gz
netsurf-4be18fcf473b5bff57daa1b57e3de961134a546a.tar.bz2
detect monkey exit rather than waiting forever for a defunct process
-rw-r--r--test/monkeyfarmer.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/monkeyfarmer.py b/test/monkeyfarmer.py
index cbd979cad..539fab597 100644
--- a/test/monkeyfarmer.py
+++ b/test/monkeyfarmer.py
@@ -55,7 +55,17 @@ class MonkeyFarmer(asyncore.dispatcher):
def handle_connect(self):
pass
+
+ 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:
@@ -162,6 +172,10 @@ class Browser:
self.stopped = True
elif what == 'LAUNCH':
self.launchurl = args[1]
+ elif what == 'EXIT':
+ if not self.stopped:
+ print("Unexpected exit of monkey process with code {}".format(args[0]))
+ assert(self.stopped)
else:
# TODO: Nothing for now?
pass