mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
Merge pull request #19181 from github/aibaars/rust-delete-cargo-lock
Rust: QLTest: delete Cargo.lock files
This commit is contained in:
@@ -4,6 +4,7 @@ use glob::glob;
|
||||
use itertools::Itertools;
|
||||
use std::ffi::OsStr;
|
||||
use std::fs;
|
||||
use std::path::Path;
|
||||
use std::process::Command;
|
||||
use tracing::info;
|
||||
|
||||
@@ -58,9 +59,18 @@ fn set_sources(config: &mut Config) -> anyhow::Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn remove_file_if_exists(path: &Path) -> anyhow::Result<()> {
|
||||
match fs::remove_file(path) {
|
||||
Err(e) if e.kind() == std::io::ErrorKind::NotFound => Ok(()),
|
||||
x => x,
|
||||
}
|
||||
.context(format!("removing file {}", path.display()))
|
||||
}
|
||||
|
||||
pub(crate) fn prepare(config: &mut Config) -> anyhow::Result<()> {
|
||||
dump_lib()?;
|
||||
set_sources(config)?;
|
||||
remove_file_if_exists(Path::new("Cargo.lock"))?;
|
||||
dump_cargo_manifest(&config.qltest_dependencies)?;
|
||||
if config.qltest_cargo_check {
|
||||
let status = Command::new("cargo")
|
||||
|
||||
Reference in New Issue
Block a user