summaryrefslogtreecommitdiffstats
path: root/src/testdir/test_channel.py
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-02-04 00:11:37 +0100
committerBram Moolenaar <Bram@vim.org>2016-02-04 00:11:37 +0100
commitb3e2f00f39d6edafda6e5508a926ebd244997a0f (patch)
tree6437a40ea85c1e56e715260cf45b919281b27a31 /src/testdir/test_channel.py
parent66624ff0d9e1de2fc5eb4f95f3a3a2ed70b10138 (diff)
patch 7.4.1256v7.4.1256
Problem: On Mac sys.exit(0) doesn't kill the test server. Solution: Use self.server.shutdown(). (Jun Takimoto)
Diffstat (limited to 'src/testdir/test_channel.py')
-rw-r--r--src/testdir/test_channel.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/testdir/test_channel.py b/src/testdir/test_channel.py
index dbf9eb2c7b..fb75938c1f 100644
--- a/src/testdir/test_channel.py
+++ b/src/testdir/test_channel.py
@@ -98,7 +98,8 @@ class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler):
response = last_eval
elif decoded[1] == '!quit!':
# we're done
- sys.exit(0)
+ self.server.shutdown()
+ break
elif decoded[1] == '!crash!':
# Crash!
42 / 0
@@ -127,7 +128,6 @@ if __name__ == "__main__":
server_thread = threading.Thread(target=server.serve_forever)
# Exit the server thread when the main thread terminates
- server_thread.daemon = True
server_thread.start()
# Write the port number in Xportnr, so that the test knows it.
@@ -135,6 +135,7 @@ if __name__ == "__main__":
f.write("{}".format(port))
f.close()
- # Block here
print("Listening on port {}".format(port))
- server.serve_forever()
+
+ # Main thread terminates, but the server continues running
+ # until server.shutdown() is called.