Skip to content

Commit

Permalink
fix ci failing because of --free-space option
Browse files Browse the repository at this point in the history
  • Loading branch information
qjerome committed Sep 20, 2023
1 parent 6b13658 commit 8f23823
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions xtask/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ mod tools;
mod user;
mod utils;

use std::io::ErrorKind;

use clap::Parser;

#[derive(Debug, Parser)]
Expand Down Expand Up @@ -81,11 +83,19 @@ fn main() -> Result<(), anyhow::Error> {
// we free up all LLVM build artifacts
if opts.free_space {
println!("Removing LLVM build artifacts");
std::fs::remove_dir_all(llvm_dir)?;
let res = std::fs::remove_dir_all(llvm_dir);
// if error is different from NotFound we return an error
if res.as_ref().is_err_and(|e| e.kind() != ErrorKind::NotFound) {
return Err(res.err().unwrap().into());
}
}

if opts.update {
let _ = std::fs::remove_dir_all(&linker_dir);
let res = std::fs::remove_dir_all(&linker_dir);
// if error is different from NotFound we return an error
if res.as_ref().is_err_and(|e| e.kind() != ErrorKind::NotFound) {
return Err(res.err().unwrap().into());
}
}

if linker_dir.is_dir() {
Expand Down

0 comments on commit 8f23823

Please sign in to comment.