Skip to content

Commit

Permalink
fix xwin invocation ignoring errors and having args in wrong order
Browse files Browse the repository at this point in the history
  • Loading branch information
dankmeme01 committed Aug 21, 2024
1 parent 015e587 commit 750e6a4
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions src/sdk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ fn download_xwin(dest: &Path) -> Result<(), Box<dyn std::error::Error>> {
.arg("--strip-components=1")
.args(["-C", dest.parent().unwrap().to_str().unwrap()])
.arg(format!("{name}/xwin"))
.output()
.status()
.nice_unwrap("Failed to extract the archive with 'tar'");

let _ = std::fs::remove_file(archive_path);
Expand Down Expand Up @@ -819,22 +819,28 @@ fn install_linux(

let mut cmd = std::process::Command::new(xwin_exe_path);

cmd.arg("--accept-license")
.args(["--arch", &arch])
.arg("splat")
.args([
cmd.arg("--accept-license");
cmd.args(["--arch", &arch]);

// this argument must come before `splat`
if let Some(winsdk_version) = winsdk_version {
cmd.args(["--sdk-version", &winsdk_version]);
}

cmd.arg("splat");
cmd.args([
"--output",
splat_path
.to_str()
.nice_unwrap("Failed to convert path to str"),
])
.arg("--include-debug-libs");
]);
cmd.arg("--include-debug-libs");

if let Some(winsdk_version) = winsdk_version {
cmd.args(["--sdk-version", &winsdk_version]);
let status = cmd.status().nice_unwrap("Failed to execute xwin");

if !status.success() {
fatal!("xwin failed with code {}", status.code().unwrap_or_default());
}

cmd.output().nice_unwrap("Failed to install Windows SDK");
}

if toolchain_path.exists() {
Expand Down

0 comments on commit 750e6a4

Please sign in to comment.