Skip to content

Commit

Permalink
fix behavior with ctrl+c
Browse files Browse the repository at this point in the history
  • Loading branch information
vitchyr committed Oct 11, 2018
1 parent bbb6a63 commit 7369b48
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions viskit/frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -810,11 +810,15 @@ def reload_data(data_filename):
reload_data(args.dname)
for i in range(10):
port = args.port + i
complete = True
try:
app.run(host='0.0.0.0', port=port, debug=args.debug)
print("Done! View http://localhost:%d in your browser" % port)
app.run(host='0.0.0.0', port=port, debug=args.debug)
except OSError as e:
if e.errno != 98:
raise e
print("Port {} is being used. Trying next port.".format(port))
print("All tried ports are busy. Try specifying a port with --port=6000")
if e.strerror == 'Address already in use':
complete = False
print("Port {} is being used. Trying next port.".format(port))
if complete:
break
if i == 9:
print("All tried ports are busy. Try specifying a port with --port=6000")

0 comments on commit 7369b48

Please sign in to comment.