Fix --commit-id flag for code serve-web (#258904)

* Fix --commit-id flag for code serve-web

Fixes a bug where passing --commit-id during `code serve-web` would
prevent serve-web from downloading a new version of the client at all.

* Update cli/src/commands/serve_web.rs

---------

Co-authored-by: Connor Peet <connor@peet.io>
This commit is contained in:
Justin Wang 2025-07-31 12:52:39 -04:00 committed by GitHub
parent 1297e26760
commit b0271fa725
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 0 deletions

View File

@ -91,6 +91,12 @@ pub async fn serve_web(ctx: CommandContext, mut args: ServeWebArgs) -> Result<i3
if args.commit_id.is_none() {
cm.clone()
.start_update_checker(Duration::from_secs(update_check_interval));
} else {
// If a commit was provided, invoke get_latest_release() once to ensure we're using that exact version;
// get_latest_release() will short-circuit to args.commit_id.
if let Err(e) = cm.get_latest_release().await {
warning!(cm.log, "error getting latest version: {}", e);
}
}
let key = get_server_key_half(&ctx.paths);