From 3941870f19da9cd3d0e061fa9727ebba5c94ba47 Mon Sep 17 00:00:00 2001 From: Connor Peet Date: Wed, 13 Sep 2023 08:17:48 -0700 Subject: [PATCH] cli: fix panic if it can't bind a port (#193019) Fixes #192229 --- cli/src/commands/serve_web.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cli/src/commands/serve_web.rs b/cli/src/commands/serve_web.rs index 2181c6339a4..7f200d4341f 100644 --- a/cli/src/commands/serve_web.rs +++ b/cli/src/commands/serve_web.rs @@ -120,6 +120,7 @@ pub async fn serve_web(ctx: CommandContext, mut args: ServeWebArgs) -> Result SocketAddr::new(IpAddr::V4(Ipv4Addr::LOCALHOST), args.port), }; + let builder = Server::try_bind(&addr).map_err(CodeError::CouldNotListenOnInterface)?; let mut listening = format!("Web UI available at http://{}", addr); if let Some(ct) = args.connection_token { @@ -127,7 +128,7 @@ pub async fn serve_web(ctx: CommandContext, mut args: ServeWebArgs) -> Result