mirror of
https://github.com/onionshare/onionshare.git
synced 2024-12-27 08:19:41 -05:00
Catch exception that occurs when stopping a web app that has not started (fixes #237)
This commit is contained in:
parent
9b83c3d959
commit
d67d5010d1
@ -279,11 +279,14 @@ def stop(port):
|
||||
Stop the flask web server by loading /shutdown.
|
||||
"""
|
||||
# to stop flask, load http://127.0.0.1:<port>/<shutdown_slug>/shutdown
|
||||
if transparent_torification:
|
||||
import socket
|
||||
try:
|
||||
if transparent_torification:
|
||||
import socket
|
||||
|
||||
s = socket.socket()
|
||||
s.connect(('127.0.0.1', port))
|
||||
s.sendall('GET /{0:s}/shutdown HTTP/1.1\r\n\r\n'.format(shutdown_slug))
|
||||
else:
|
||||
urllib2.urlopen('http://127.0.0.1:{0:d}/{1:s}/shutdown'.format(port, shutdown_slug)).read()
|
||||
s = socket.socket()
|
||||
s.connect(('127.0.0.1', port))
|
||||
s.sendall('GET /{0:s}/shutdown HTTP/1.1\r\n\r\n'.format(shutdown_slug))
|
||||
else:
|
||||
urllib2.urlopen('http://127.0.0.1:{0:d}/{1:s}/shutdown'.format(port, shutdown_slug)).read()
|
||||
except:
|
||||
pass
|
||||
|
Loading…
Reference in New Issue
Block a user