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

Truncate standalone test files instead of removing #2778

Merged
merged 2 commits into from
Jan 8, 2024
Merged
Changes from 1 commit
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
9 changes: 8 additions & 1 deletion crates/tests/standalone/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,14 @@ fn write_no_inner_attr(output: &str, filter: &[&str]) {
}

fn riddle(output: &str, filter: &[&str], config: &[&str]) {
_ = std::fs::remove_file(output);
// Rust-analyzer may re-run build scripts whenever a source file is deleted
// which causes an endless loop if the file is deleted from a build script.
// To workaroud this, we truncate the file instead of deleting it.
kennykerr marked this conversation as resolved.
Show resolved Hide resolved
// See https://github.com/microsoft/windows-rs/issues/2777
_ = std::fs::File::options()
.truncate(true)
.write(true)
.open(output);

let mut command = std::process::Command::new("cargo");

Expand Down