Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix rust-src installation #188

Merged
merged 5 commits into from
Feb 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ pub enum Error {
#[error("{} Failed to query GitHub API.", emoji::ERROR)]
GithubQuery,

#[diagnostic(code(espup::toolchain::rust::install_xtensa_rust))]
#[error("{} Failed to Install Xtensa Rust toolchain.", emoji::ERROR)]
InstallXtensaRust,

#[diagnostic(code(espup::toolchain::rust::install_riscv_target))]
#[error(
"{} Failed to Install RISC-V targets for '{0}' toolchain.",
Expand Down
14 changes: 4 additions & 10 deletions src/toolchain/rust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,10 @@ impl Installable for XtensaRust {
self.toolchain_destination.display()
);

let mut child1 = Command::new("/usr/bin/env")
Command::new("/usr/bin/env")
.args(["bash", "-c", &arguments])
.stdout(Stdio::null())
.spawn()?;
.output()?;

let temp_rust_src_dir = tempfile::TempDir::new()
.unwrap()
Expand All @@ -267,21 +267,15 @@ impl Installable for XtensaRust {
self.toolchain_destination.display()
);

let mut child2 = Command::new("/usr/bin/env")
Command::new("/usr/bin/env")
.args(["bash", "-c", &arguments])
.stdout(Stdio::null())
.spawn()?;

// Wait for both child processes to finish and check their exit status
if !child1.wait()?.success() || !child2.wait()?.success() {
return Err(Error::InstallXtensaRust);
}
.output()?;
}
// Some platfroms like Windows are available in single bundle rust + src, because install
// script in dist is not available for the plaform. It's sufficient to extract the toolchain
#[cfg(windows)]
if cfg!(windows) {
// TODO: Windows only supports `esp` as toolchain name atm since its hardcoded in the rust-build asset
download_file(
self.dist_url.clone(),
"rust.zip",
Expand Down