File tree Expand file tree Collapse file tree 1 file changed +7
-11
lines changed Expand file tree Collapse file tree 1 file changed +7
-11
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ use std::io::BufWriter;
1212use std:: path:: Path ;
1313use std:: path:: PathBuf ;
1414use std:: sync:: atomic:: { AtomicU32 , Ordering } ;
15- use tracing:: { error, info, warn } ;
15+ use tracing:: { error, info} ;
1616
1717/// A representation of the recording of activity of triagebot.
1818///
@@ -89,18 +89,14 @@ fn next_sequence() -> u32 {
8989/// `TRIAGEBOT_TEST_RECORD` environment variable is set.
9090pub fn init ( ) -> Result < ( ) > {
9191 let Some ( record_dir) = record_dir ( ) else { return Ok ( ( ) ) } ;
92+ if record_dir. exists ( ) && record_dir. read_dir ( ) ?. next ( ) . is_some ( ) {
93+ panic ! (
94+ "{record_dir:?} already exists.\n \
95+ Delete the directory before recording if you wish to re-record that test."
96+ ) ;
97+ }
9298 fs:: create_dir_all ( & record_dir)
9399 . with_context ( || format ! ( "failed to create recording directory {record_dir:?}" ) ) ?;
94- // Clear any old recording data.
95- for entry in fs:: read_dir ( & record_dir) ? {
96- let entry = entry?;
97- let path = entry. path ( ) ;
98- if path. extension ( ) . and_then ( |p| p. to_str ( ) ) == Some ( "json" ) {
99- warn ! ( "deleting old recording at {path:?}" ) ;
100- fs:: remove_file ( & path)
101- . with_context ( || format ! ( "failed to remove old recording {path:?}" ) ) ?;
102- }
103- }
104100 Ok ( ( ) )
105101}
106102
You can’t perform that action at this time.
0 commit comments