Skip to content

Commit

Permalink
Don't silently overwrite .cargo/config.toml in the publish script (#…
Browse files Browse the repository at this point in the history
…8993)

* Don't silently overwrite `.cargo/config.toml` in the publish script

Warn if it exists and exit instead.

* Don't rely on new Rust stdlib
  • Loading branch information
fitzgen authored Jul 23, 2024
1 parent 0549bad commit 7dcb9bd
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions scripts/publish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -487,8 +487,17 @@ fn publish(krate: &Crate) -> bool {
fn verify(crates: &[Crate]) {
verify_capi();

drop(fs::remove_dir_all(".cargo"));
drop(fs::remove_dir_all("vendor"));
if Path::new(".cargo").exists() {
panic!(
"`.cargo` already exists on the file system, remove it and then run the script again"
);
}
if Path::new("vendor").exists() {
panic!(
"`vendor` already exists on the file system, remove it and then run the script again"
);
}

let vendor = cmd_output(Command::new("cargo").arg("vendor").stderr(Stdio::inherit()));
assert!(vendor.status.success());

Expand Down

0 comments on commit 7dcb9bd

Please sign in to comment.