From 481a942b76044ee81cad065cdfb3d6eb3eb177ad Mon Sep 17 00:00:00 2001 From: Gideon <87426140+GideonBear@users.noreply.github.com> Date: Thu, 3 Apr 2025 11:38:38 +0200 Subject: [PATCH] =?UTF-8?q?Fix=20`pixi=20self-update`=20running=20when=20`?= =?UTF-8?q?pixi`=20is=20not=20installed=20with=20the=20=E2=80=A6=20(#1087)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix `pixi self-update` running when `pixi` is not installed with the `self-update` feature * Format --- src/steps/generic.rs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/steps/generic.rs b/src/steps/generic.rs index 46e5ec43..95f98a66 100644 --- a/src/steps/generic.rs +++ b/src/steps/generic.rs @@ -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)