1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-18 03:44:05 -05:00

Interrupt http_server.py by ctrl + c (#1001)

This commit is contained in:
Amos Lim 2018-10-17 00:54:08 +09:00 committed by Ryan Dahl
parent c61a0f2f84
commit a90cf4c2ee

View file

@ -2,6 +2,7 @@
# Many tests expect there to be an http server on port 4545 servering the deno
# root directory.
import os
import sys
from threading import Thread
import SimpleHTTPServer
import SocketServer
@ -51,8 +52,11 @@ def spawn():
r_thread.daemon = True
r_thread.start()
sleep(1) # TODO I'm too lazy to figure out how to do this properly.
return thread
if __name__ == '__main__':
spawn().join()
try:
spawn()
while True: sleep(100)
except KeyboardInterrupt:
sys.exit()