mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-29 17:47:14 +02:00
Fix issue with invalid checking used port for PIO Home server
This commit is contained in:
@ -88,12 +88,13 @@ def cli(port, host, no_open, shutdown_timeout):
|
||||
return
|
||||
|
||||
# if already started
|
||||
already_started = False
|
||||
socket.setdefaulttimeout(1)
|
||||
already_started = True
|
||||
try:
|
||||
socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect((host, port))
|
||||
already_started = True
|
||||
except: # pylint: disable=bare-except
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
s.bind((host, port))
|
||||
s.close()
|
||||
already_started = False
|
||||
except (OSError, socket.error):
|
||||
pass
|
||||
|
||||
home_url = "http://%s:%d" % (host, port)
|
||||
|
Reference in New Issue
Block a user