We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 115c6dd commit 40cc4efCopy full SHA for 40cc4ef
1 file changed
reflex/utils/processes.py
@@ -87,13 +87,13 @@ def _can_bind_at_any_port(address_family: socket.AddressFamily | int) -> bool:
87
Returns:
88
Whether any port is available for binding.
89
"""
90
- with closing(socket.socket(address_family, socket.SOCK_STREAM)) as sock:
91
- try:
+ try:
+ with closing(socket.socket(address_family, socket.SOCK_STREAM)) as sock:
92
sock.bind(("", 0)) # Bind to any available port
93
- except (OverflowError, PermissionError, OSError) as e:
94
- console.debug(f"Unable to bind to any port for {address_family}: {e}")
95
- return False
96
- return True
+ return True
+ except (OverflowError, PermissionError, OSError) as e:
+ console.debug(f"Unable to bind to any port for {address_family}: {e}")
+ return False
97
98
99
def is_process_on_port(
0 commit comments