mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-30 01:57:13 +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
|
return
|
||||||
|
|
||||||
# if already started
|
# if already started
|
||||||
already_started = False
|
already_started = True
|
||||||
socket.setdefaulttimeout(1)
|
|
||||||
try:
|
try:
|
||||||
socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect((host, port))
|
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
already_started = True
|
s.bind((host, port))
|
||||||
except: # pylint: disable=bare-except
|
s.close()
|
||||||
|
already_started = False
|
||||||
|
except (OSError, socket.error):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
home_url = "http://%s:%d" % (host, port)
|
home_url = "http://%s:%d" % (host, port)
|
||||||
|
Reference in New Issue
Block a user