Skip to content

fix(utility): use errno.ECONNREFUSED for cross-platform port detection; fix typo#442

Open
suradadhanush wants to merge 1 commit into
adeyosemanputra:masterfrom
suradadhanush:fix/utility-errno-typo
Open

fix(utility): use errno.ECONNREFUSED for cross-platform port detection; fix typo#442
suradadhanush wants to merge 1 commit into
adeyosemanputra:masterfrom
suradadhanush:fix/utility-errno-typo

Conversation

@suradadhanush

Copy link
Copy Markdown

Problems

Cross-platform (Medium): result == 111 hardcodes the Linux-specific value for ECONNREFUSED. On Windows the equivalent is 10061get_free_port() silently returns None on Windows, meaning challenge containers never start.

Typo (Low): Print statement says "avilable" instead of "available".

Fix

  • import errno added
  • result == 111 replaced with result == errno.ECONNREFUSED — Python resolves this to the correct value per platform at runtime
  • Typo corrected in print statement

Testing

  • Linux: errno.ECONNREFUSED == 111 — zero functional change
  • Windows: errno.ECONNREFUSED == 10061 — port detection now works correctly
  • Flake8 passes — errno is used immediately after import

…n; fix typo

- Replace hardcoded 111 with errno.ECONNREFUSED (resolves correctly on Windows/Linux)
- Fix typo: 'avilable' -> 'available' in print statement
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant