Mercurial > vim
diff src/testdir/test_channel.py @ 7920:1ebc7be4dbbf v7.4.1256
commit https://github.com/vim/vim/commit/b3e2f00f39d6edafda6e5508a926ebd244997a0f
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Feb 4 00:11:37 2016 +0100
patch 7.4.1256
Problem: On Mac sys.exit(0) doesn't kill the test server.
Solution: Use self.server.shutdown(). (Jun Takimoto)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 04 Feb 2016 00:15:04 +0100 |
parents | ce5a7a613867 |
children | 2e905dfc6999 |
line wrap: on
line diff
--- a/src/testdir/test_channel.py +++ b/src/testdir/test_channel.py @@ -98,7 +98,8 @@ class ThreadedTCPRequestHandler(socketse 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.