Fix pixi self-update running when pixi is not installed with the … (#1087)

* Fix `pixi self-update` running when `pixi` is not installed with the `self-update` feature

* Format
This commit is contained in:
Gideon
2025-04-03 11:38:38 +02:00
committed by GitHub
parent a601d8429d
commit 481a942b76

View File

@@ -553,11 +553,17 @@ pub fn run_pixi_update(ctx: &ExecutionContext) -> Result<()> {
let pixi = require("pixi")?;
print_separator("Pixi");
ctx.run_type()
.execute(&pixi)
.args(["self-update"])
.status_checked()
.ok();
// Check if `pixi --help` mentions self-update, if yes, self-update must be enabled.
// pixi self-update --help works regardless of whether the feature is enabled.
let output = ctx.run_type().execute(&pixi).arg("--help").output_checked()?;
if String::from_utf8(output.stdout)?.contains("self-update") {
ctx.run_type()
.execute(&pixi)
.args(["self-update"])
.status_checked()
.ok();
}
ctx.run_type()
.execute(&pixi)