mirror of
https://github.com/onionshare/onionshare.git
synced 2025-05-20 07:10:35 -04: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
1 changed files with 10 additions and 7 deletions
|
@ -279,11 +279,14 @@ def stop(port):
|
||||||
Stop the flask web server by loading /shutdown.
|
Stop the flask web server by loading /shutdown.
|
||||||
"""
|
"""
|
||||||
# to stop flask, load http://127.0.0.1:<port>/<shutdown_slug>/shutdown
|
# to stop flask, load http://127.0.0.1:<port>/<shutdown_slug>/shutdown
|
||||||
if transparent_torification:
|
try:
|
||||||
import socket
|
if transparent_torification:
|
||||||
|
import socket
|
||||||
|
|
||||||
s = socket.socket()
|
s = socket.socket()
|
||||||
s.connect(('127.0.0.1', port))
|
s.connect(('127.0.0.1', port))
|
||||||
s.sendall('GET /{0:s}/shutdown HTTP/1.1\r\n\r\n'.format(shutdown_slug))
|
s.sendall('GET /{0:s}/shutdown HTTP/1.1\r\n\r\n'.format(shutdown_slug))
|
||||||
else:
|
else:
|
||||||
urllib2.urlopen('http://127.0.0.1:{0:d}/{1:s}/shutdown'.format(port, shutdown_slug)).read()
|
urllib2.urlopen('http://127.0.0.1:{0:d}/{1:s}/shutdown'.format(port, shutdown_slug)).read()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue