Skip to content

Handle web UI port startup errors - #70

Merged
blixvip merged 3 commits into
blixvip:mainfrom
Kareenashinde15:fix-busy-port-error
Nov 15, 2026
Merged

blixvip merged 3 commits into
blixvip:mainfrom
Kareenashinde15:fix-busy-port-error

Conversation

@Kareenashinde15

Copy link
Copy Markdown
Contributor

Summary

  • Validate the EASYEDIT_PORT environment variable.
  • Handle invalid and out-of-range port values with actionable error messages.
  • Handle server startup failures, including ports that are already in use.
  • Add regression tests for port validation and occupied-port errors.

Testing

  • Ran the targeted port validation tests.
  • Ran the existing server startup tests.
  • Ran the complete test suite.
  • All tests passed.

Fixes #47

@blixvip blixvip left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Kareenashinde15! This covers both halves of #47: the busy port and the import-time ValueError. The tests are nicely targeted. 83 tests pass here, and with a real socket holding the port, main() now exits cleanly instead of printing a traceback.

One small fix: the two string pieces in the busy-port message are joined without a space, so the user sees this:

cannot start easyedit web UI on port 4339: [Errno 98] Address already in use. Choose another port by setting EASYEDIT_PORT.PowerShell: $env:EASYEDIT_PORT='4332'

Adding a space (and making the example easier to read) fixes it:

-            "Choose another port by setting EASYEDIT_PORT."
-            "PowerShell: $env:EASYEDIT_PORT='4332'"
+            "Choose another port by setting EASYEDIT_PORT "
+            "(PowerShell: $env:EASYEDIT_PORT='4332')."

Optional nit: put two blank lines after get_port(), before WEB = ..., to match the rest of the module. Push the fix and I'll merge.

@Kareenashinde15

Copy link
Copy Markdown
Contributor Author

Thanks for the review!
I have fixed the spacing in the busy-port error message and improved the PowerShell example. I have also corrected the port validation return statement.
All 83 tests are passing, and I've pushed the updates to this PR.
Please let me know if anything else needs to be changed.

@blixvip

blixvip commented Nov 15, 2026

Copy link
Copy Markdown
Owner

Verified locally: the suite goes from 78 to 83 tests and all five new ones pass. The two pre-existing failures (test_preflight) fail identically on main here — this machine has no ffmpeg and no npm install — so they're unrelated to this change.

Checked that no stale PORT references were left behind after the module-level constant became get_port(); main() is the only caller. Good call validating the 1–65535 range as well as the parse, and raising SystemExit so the CLI prints the message without a traceback.

Thanks @Kareenashinde15 — and thanks for turning #69 around so quickly after the review. Merging.

@blixvip
blixvip merged commit e5cbeb0 into blixvip:main Nov 15, 2026
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.

Report a busy port instead of a traceback when the web UI starts

2 participants