Skip to content

Commit 79727f9

Browse files
Fixed the file cursor error
1 parent 1386bd8 commit 79727f9

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

crates/evm/evm/src/executors/fuzz/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use proptest::test_runner::{TestCaseError, TestError, TestRunner};
2121
use std::{
2222
cell::RefCell,
2323
collections::BTreeMap,
24-
io::{Read, Write},
24+
io::{Read, Seek, SeekFrom, Write},
2525
};
2626

2727
mod types;
@@ -328,6 +328,8 @@ impl FuzzedExecutor {
328328
let mut existing: Vec<File> = serde_json::from_slice(&existing).unwrap_or_default();
329329
existing.push(result);
330330
let result = serde_json::to_vec_pretty(&existing).unwrap();
331+
file.seek(SeekFrom::Start(0)).unwrap();
332+
file.set_len(0).unwrap();
331333
file.write_all(&result).unwrap();
332334
}
333335

crates/forge/src/runner.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ use std::{
4141
borrow::Cow,
4242
cmp::min,
4343
collections::BTreeMap,
44+
io::{Read, Seek, SeekFrom, Write},
4445
path::{Path, PathBuf},
45-
io::{Read, Write},
4646
sync::Arc,
4747
time::Instant,
4848
};
@@ -596,6 +596,8 @@ impl<'a> FunctionRunner<'a> {
596596
let mut existing: Vec<File> = serde_json::from_slice(&existing).unwrap_or_default();
597597
existing.push(result);
598598
let result = serde_json::to_vec_pretty(&existing).unwrap();
599+
file.seek(SeekFrom::Start(0)).unwrap();
600+
file.set_len(0).unwrap();
599601
file.write_all(&result).unwrap();
600602
}
601603

0 commit comments

Comments
 (0)