Skip to content

Commit

Permalink
Fixed the error if user again input the same port
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr-Sunglasses committed Jul 17, 2023
1 parent a3c9f5a commit 42744c6
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions robyn/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,15 +155,22 @@ def start(self, url: str = "127.0.0.1", port: int = 8080):
logger.error(
f"Failed to connect because port {port} is in use (or bad host)"
)
question_port = [
{
"type": "input",
"message": "Please Enter a new Port:",
"name": "new_port",
}
]
port_value = prompt(question_port)
port = int(port_value["new_port"])
while True:
question_port = [
{
"type": "input",
"message": "Please Enter a new Port:",
"name": "new_port",
}
]
port_value = prompt(question_port)
port = int(port_value["new_port"])
if is_port_in_use(port):
logger.error(
f"Failed to connect because port {port} is in use (or bad host)"
)
else:
break

logger.info(f"Robyn version: {__version__}")
logger.info(f"Starting server at {url}:{port}")
Expand Down

0 comments on commit 42744c6

Please sign in to comment.