Skip to content

Commit

Permalink
Improved error message for local port usage check
Browse files Browse the repository at this point in the history
Helping with #29.
  • Loading branch information
RussellJoyce committed Apr 27, 2020
1 parent b0a8b60 commit 803d63e
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions vlab.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
############################


def err(s):
print(s)
def err(error_string):
print(error_string)
sys.exit(1)


Expand Down Expand Up @@ -102,13 +102,15 @@ def err(s):
web_port_in_use = (s.connect_ex(('localhost', web_port)) == 0)

if local_port_in_use:
print("Local port {} is in use by another user on this machine, or otherwise unavailable. "
"Specify a different port with --localport.".format(local_port))
print("Error: Local port {} is in use by another user on this machine, or otherwise unavailable. "
"Specify a different port with --localport or -l.".format(local_port))
if web_port_in_use:
print("Web forward port {} is in use by another user on this machine, or otherwise unavailable. "
"Specify a different port with --webport.".format(web_port))
print("Error: Web forward port {} is in use by another user on this machine, or otherwise unavailable. "
"Specify a different port with --webport or -w.".format(web_port))
if local_port_in_use or web_port_in_use:
exit(1)
err("\nEach user must choose their own unique local ports when running on a shared machine (e.g. a departmental "
"server).\nSee the section on 'Using the VLAB on a Shared Machine' at "
"https://wiki.york.ac.uk/display/RTS/Using+the+Xilinx+Tools+Remotely for more information.")

# First get a port to use on the relay server
if parsed.user is not None:
Expand Down

0 comments on commit 803d63e

Please sign in to comment.