feat(cli): add feature to disable downloads (#3465)

* feat(cli): add feature to disable downloads

---------

Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
This commit is contained in:
CathalandJonathan Kelley authored and GitHub committed 2025-01-16 16:49:30 -08:00
1 parent cd121f2828
commit c7951b7dd5
11 files changed
+485 -536

No files matched your search

+31
View File
@@ -0,0 +1,31 @@
use crate::Result;
use anyhow::Context;
use std::path::PathBuf;
use tokio::process::Command;
#[derive(Debug, Default)]
pub struct RustcDetails {
pub sysroot: PathBuf,
}
impl RustcDetails {
/// Find the current sysroot location using the CLI
pub async fn from_cli() -> Result<RustcDetails> {
let output = Command::new("rustc")
.args(["--print", "sysroot"])
.output()
.await?;
let stdout =
String::from_utf8(output.stdout).context("Failed to extract rustc sysroot output")?;
let sysroot = PathBuf::from(stdout.trim());
Ok(Self { sysroot })
}
pub fn has_wasm32_unknown_unknown(&self) -> bool {
self.sysroot
.join("lib/rustlib/wasm32-unknown-unknown")
.exists()
}
}