feat(serve): support --port 0 to use an open port (#23846)

Closes https://github.com/denoland/deno/issues/23845
This commit is contained in:
Satya Rohith 2024-05-17 11:08:50 +05:30 committed by GitHub
parent 2b560be83f
commit 20cb0e8863
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 96 additions and 16 deletions

View file

@ -62,7 +62,6 @@ use std::env;
use std::io::BufReader;
use std::io::Cursor;
use std::net::SocketAddr;
use std::num::NonZeroU16;
use std::num::NonZeroUsize;
use std::path::Path;
use std::path::PathBuf;
@ -1036,7 +1035,7 @@ impl CliOptions {
}
}
pub fn serve_port(&self) -> Option<NonZeroU16> {
pub fn serve_port(&self) -> Option<u16> {
if let DenoSubcommand::Serve(flags) = self.sub_command() {
Some(flags.port)
} else {