Skip to content
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
8 changes: 7 additions & 1 deletion tests/hook_cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1339,7 +1339,13 @@ fn stop_waits_for_a_baseline_that_is_still_being_written() {
std::thread::spawn(move || {
std::thread::sleep(std::time::Duration::from_secs(1));
let baseline = r#"{"ran":[["test","!","-e","red"]],"red":[["test","!","-e","red"]]}"#;
std::fs::write(directory.join("s-wait.json"), baseline).unwrap();
// Renamed into place, as `SessionStart` writes it. Written in
// place instead, the file exists empty for an instant, and a Stop
// polling for it can read that instant as an unreadable baseline.
// The partial file's name is not the baseline's, so no poll opens it.
let partial = directory.join("s-wait.json.partial");
std::fs::write(&partial, baseline).unwrap();
std::fs::rename(&partial, directory.join("s-wait.json")).unwrap();
std::fs::remove_file(directory.join("s-wait.pending")).unwrap();
})
};
Expand Down
Loading