Skip to content

Commit

Permalink
uv step: checking self subcommand exits; fixes #942
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaspar committed Oct 29, 2024
1 parent f181a79 commit e83835d
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/steps/generic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
return ctx
.run_type()
.execute(&uv_exec)
.args(["self", "update"])
.status_checked();
}

ctx.run_type()
.execute(&uv_exec)
Expand Down

0 comments on commit e83835d

Please sign in to comment.