web: --port 0 now works in --serve-browse mode too - #2723
Open
acinader wants to merge 1 commit into
Open
Conversation
Contributor
Author
Contributor
Author
|
I am switching to using this for my work so I can dog food test the keep alive and the port 0 stuff. |
--port 0 (let the OS choose a free port, plaintextaccounting#2559) was refused in browse mode because wai-handler-launch had to be given a port number up front. Now that hledger-web runs warp itself in that mode, it can serve on the socket it already bound to the chosen port, exactly as --serve does, and open the browser at the base url built from that port. The browse-mode browser spec now starts its server with --port 0 instead of on a fixed port 5089, and its launcher stub records the url it is given, so the spec also checks that the browser is opened at the chosen port. To support that, the suite's one server starter now reads the url from the startup banner (and keeps the server's output, so a failure to start is reported with its message) for both of its callers. AI usage: Claude Fable 5.1, ~8k output tokens
acinader
force-pushed
the
web-browse-port0
branch
from
September 9, 2026 02:07
2d802d9 to
3bc9c57
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
--port 0(#2559, let the OS choose a free port) now works in the default--serve-browsemode as well.Follows #2722, now merged.
Prior to #2722 we errored when trying to get the OS to assign a port in
--serve-browsemode, because the browser launcher of the time, wai-handler-launch, had to be given a port number up front. Since #2722, hledger-web runs warp itself in that mode, so it can serve on the socket it already bound to the OS-chosen port, exactly as--servedoes, and open the browser at the base url built from that port. This removes the exception and its error message, and the manual's and changelog's caveats about it.The browse-mode browser spec now starts its server with
--port 0rather than on a fixed port, and its launcher stub records the url it is asked to open, so the spec also checks that the browser is opened at the chosen port. To support that, the suite's one server starter now reads the url from the startup banner, for both of its callers, and keeps the server's output so that a failure to start is reported with its message.AI usage: Claude Fable 5.1, ~8k output tokens; the commit message and this description were reviewed and edited by me before publishing.