-
Couldn't load subscription status.
- Fork 1.8k
Open
Labels
C-bugCategory: A bug, incorrect or unintended behaviorCategory: A bug, incorrect or unintended behaviorCommand-serveCommand: serveCommand: serve
Description
Problem
When using the mdbook serve command with --port 0 and --open options, the opened page is wrong, as the port is 0 instead of the random port attributed by the system.
Steps
mdbook init abc --forcemdbook serve abc --port 0 --open
Possible Solution(s)
The serving_url should contain the bound port instead of the asked port (0)
Line 92 in 3a8faba
| let serving_url = format!("http://{address}"); |
Maybe using something like bind_ephemeral could be used. It would maybe require to move the creation of the warp server in a separate function run before the thread spawn.
Lines 88 to 90 in 3a8faba
| let thread_handle = std::thread::spawn(move || { | |
| serve(build_dir, sockaddr, reload_tx, &file_404); | |
| }); |
Notes
No response
Version
mdbook v0.4.47
Metadata
Metadata
Assignees
Labels
C-bugCategory: A bug, incorrect or unintended behaviorCategory: A bug, incorrect or unintended behaviorCommand-serveCommand: serveCommand: serve
