From 39f76a3a71fbac7767247521e7f91fa4013d8b9f Mon Sep 17 00:00:00 2001 From: Lucas Parzianello <7535699+lucaspar@users.noreply.github.com> Date: Tue, 29 Oct 2024 01:40:31 -0600 Subject: [PATCH] uv step: checking self subcommand exits; fixes #942 (#971) * uv step: checking self subcommand exits; fixes #942 * uv: fixing return behavior --------- Co-authored-by: Lucas Parzianello --- src/steps/generic.rs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/steps/generic.rs b/src/steps/generic.rs index f25f0fae..ba3e1a2c 100644 --- a/src/steps/generic.rs +++ b/src/steps/generic.rs @@ -1032,15 +1032,20 @@ pub fn run_uv(ctx: &ExecutionContext) -> Result<()> { let uv_exec = require("uv")?; print_separator("uv"); - ctx.run_type() + // try uv self --help first - if it succeeds, we call uv self update + let result = ctx + .run_type() .execute(&uv_exec) - .args(["self", "update"]) - .status_checked() - .ok(); + .args(["self", "--help"]) + .output_checked(); - // ignoring self-update errors, because they are likely due to uv's - // installation being managed by another package manager, in which - // case another step will handle the update. + if result.is_ok() { + ctx.run_type() + .execute(&uv_exec) + .args(["self", "update"]) + .status_checked() + .ok(); + } ctx.run_type() .execute(&uv_exec)