From bb9c1ac7c150decd8fd8dd7476b55be12afac38d Mon Sep 17 00:00:00 2001 From: Casper Lindschouw Date: Sun, 11 Feb 2024 11:44:09 +0100 Subject: [PATCH 1/2] fix: Explicitly provide the host-triple of the version to install Rustup has a default-host-triple setting, that may different than the actual host environment. We currently don't support these two being different, and Proto would previously fail to find the executables for the version it had just installed. While a better solution may to respect Rustup's default-host-triple and support manually specifying the host-triple, this patch at least leaves you with a working installation. --- src/proto.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/proto.rs b/src/proto.rs index 92b795c..134a12e 100644 --- a/src/proto.rs +++ b/src/proto.rs @@ -182,7 +182,7 @@ pub fn native_install( exec_command!( inherit, "rustup", - ["toolchain", "install", &channel, "--force"] + ["toolchain", "install", &triple, "--force"] ); } @@ -197,9 +197,11 @@ pub fn native_install( pub fn native_uninstall( Json(input): Json, ) -> FnResult> { + let env = get_host_environment()?; let channel = get_channel_from_version(&input.context.version); + let triple = format!("{}-{}", channel, get_target_triple(&env, NAME)?); - exec_command!(inherit, "rustup", ["toolchain", "uninstall", &channel]); + exec_command!(inherit, "rustup", ["toolchain", "uninstall", &triple]); Ok(Json(NativeUninstallOutput { uninstalled: true, From eb824b81725f9437bd2f6b06d94a20c9dd2804b1 Mon Sep 17 00:00:00 2001 From: Casper Lindschouw Date: Sun, 11 Feb 2024 19:59:54 +0100 Subject: [PATCH 2/2] fix: Provide host triple when uninstalling broken toolchain --- src/proto.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/proto.rs b/src/proto.rs index 134a12e..4540fbd 100644 --- a/src/proto.rs +++ b/src/proto.rs @@ -174,7 +174,7 @@ pub fn native_install( } else { debug!("Detected a broken toolchain, uninstalling it"); - exec_command!(inherit, "rustup", ["toolchain", "uninstall", &channel]); + exec_command!(inherit, "rustup", ["toolchain", "uninstall", &triple]); } }