svenstaro/miniserve

[feature request] fallback to random port when default port is not available

kzhsw opened this issue · 1 comments

kzhsw commented

Currently miniserve use 8080 as default port and fail when this port is unavailable, and just exits, since urls would be displayed after bind succeed, it can fallback to random port when default port is not available, and show this to user later. If port is set over command-line, or through a different option, this behavior can be disabled.
This would be helpful for windows non-dev users who would just double-click the binary and wait.

I think that's reasonable for interactive usage if a terminal is attached. Would you like to take a stab at this?