Change:
/// while new clients get new VS Code Server versions. pub async fn serve_web(ctx: CommandContext, mut args: ServeWebArgs) -> Result<i32, AnyError> { legal::require_consent(&ctx.paths, args.accept_server_license_terms)?; <del> let mut addr: SocketAddr = match &args.host { Some(h) => h.parse().map_err(CodeError::InvalidHostAddress)?, None => SocketAddr::new(IpAddr::V4(Ipv4Addr::LOCALHOST), 0), }; addr.set_port(args.port); </del> let platform: crate::update_service::Platform = PreReqChecker::new().verify().await?; if !args.without_connection_token { // Ensure there's a defined connection token, since if multiple server versions // are excuted, they will need to have a single shared token. <del> let connection_token = args .connection_token .clone() .unwrap_or_else(|| uuid::Uuid::new_v4().to_string()); ctx.log.result(format!( "Web UI available at http://{}?tkn={}", addr, connection_token, )); args.connection_token = Some(connection_token); } else { ctx.log .result(format!("Web UI available at http://{}", addr)); args.connection_token = None; </del> <ins> args.connection_token = Some( args.connection_token .clone() .unwrap_or_else(|| uuid::Uuid::new_v4().to_string()), ); </ins> } <del> let cm = ConnectionManager::new(&ctx, platform, args); let make_svc = make_service_fn(move |_conn| { </del> <ins> let cm = ConnectionManager::new(&ctx, platform, args.clone()); let make_svc = move || { </ins> let cm = cm.clone(); <del> let log = ctx.log.clone(); </del> <ins> let log = cm.log.clone(); </ins> let service = service_fn(move |req| handle(cm.clone(), log.clone(), req)); async move { Ok::<_, Infallible>(service) } <del> }); </del> <ins> }; let r = if let Some(s) = args.socket_path { let socket = listen_socket_rw_stream(&PathBuf::from(&s)).await?; ctx.log.result(format!("Web UI available on {}", s)); Server::builder(socket.into_pollable()) .serve(make_service_fn(|_| make_svc())) .await } else { let addr: SocketAddr = match &args.host { Some(h) => { SocketAddr::new(h.parse().map_err(CodeError::InvalidHostAddress)?, args.port) } None => SocketAddr::new(IpAddr::V4(Ipv4Addr::LOCALHOST), args.port), }; </ins> <del> let server = Server::bind(&addr).serve(make_svc); </del> <ins> let mut listening = format!("Web UI available at http://{}", addr); if let Some(ct) = args.connection_token { listening.push_str(&format!("?tkn={}", ct)); } ctx.log.result(listening); Server::bind(&addr) .serve(make_service_fn(|_| make_svc())) .await }; </ins> <del> server.await.map_err(CodeError::CouldNotListenOnInterface)?; </del> <ins> r.map_err(CodeError::CouldNotListenOnInterface)?; </ins> Ok(0) }

Discussion:
It doesn't look like this new CLI supports serving on a UNIX domain socket. Could we please get that in too, like in We're going to need it in order to handle auth in a proxy. (I'm happy to open a new issue for that if you need) Originally posted by in
Nice, thanks!
I can do this what now?
Also is it an issue that the socket file wasn't release/deleted after a ctrl+C? or do I clean that up manually?
We should probably automatically delete the file if it exists You can do a to make sure it's actually working . Without extra stuff you won't be able to open it in the browser, but verifying the connection should be enough.