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

chore: fix test project initialization #7418

Merged
merged 1 commit into from
Mar 18, 2024
Merged
Changes from all commits
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: 5 additions & 4 deletions crates/test-utils/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,10 +243,6 @@ pub fn initialize(target: &Path) {
write.read_to_string(&mut data).unwrap();

if data != "1" {
write.set_len(0).unwrap();
write.seek(std::io::SeekFrom::Start(0)).unwrap();
write.write_all(b"1").unwrap();

// Initialize and build.
let (prj, mut cmd) = setup_forge("template", foundry_compilers::PathStyle::Dapptools);
eprintln!("- initializing template dir in {}", prj.root().display());
Expand All @@ -259,6 +255,11 @@ pub fn initialize(target: &Path) {

// Copy the template to the global template path.
pretty_err(tpath, copy_dir(prj.root(), tpath));

// Update lockfile to mark that template is initialized.
write.set_len(0).unwrap();
write.seek(std::io::SeekFrom::Start(0)).unwrap();
write.write_all(b"1").unwrap();
}

// Release the write lock and acquire a new read lock.
Expand Down
Loading