File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change 2424import errno
2525import socket
2626import sys
27+ import threading
2728
2829if sys .platform == 'win32' :
2930 import win32file
@@ -249,9 +250,21 @@ def parse_args():
249250
250251def run (proxy_url = DEFAULT_PROXY_URL , backend_path = DEFAULT_BACKEND_PATH ):
251252 proxy = Proxy (proxy_url , backend_path )
252- proxy .serve_forever ()
253+ try :
254+ proxy .serve_forever ()
255+ except KeyboardInterrupt :
256+ proxy .shutdown ()
257+
258+
259+ def run_daemon (proxy_url = DEFAULT_PROXY_URL , backend_path = DEFAULT_BACKEND_PATH ):
260+ proxy = Proxy (proxy_url , backend_path )
261+ th = threading .Thread (name = 'jsonrpcproxy' , target = proxy .serve_forever )
262+ th .daemon = True
263+ th .start ()
264+ return proxy
253265
254266
255267if __name__ == '__main__' :
256268 args = parse_args ()
257269 run (args .proxy_url , args .backend_path )
270+
You can’t perform that action at this time.
0 commit comments