@@ -37,22 +37,25 @@ def process(self, msg, kwargs):
37
37
kwargs ['extra' ] = {** (self .extra or {}), ** (kwargs .get ('extra' ) or {})}
38
38
return msg , kwargs
39
39
40
- def write_to_file (self , file_path : str , file_content : str ) -> None :
40
+ def write_to_file (self ,
41
+ file_path : str ,
42
+ file_content : str ,
43
+ mode : str = 'a' ) -> None :
41
44
"""Writes the |file_content| into a local |file_path|."""
42
- with open (file_path , 'a' ) as file :
45
+ with open (file_path , mode ) as file :
43
46
file .writelines (file_content )
44
47
45
48
def write_fuzz_target (self , result : Result ) -> None :
46
49
"""Writes fuzz target."""
47
50
fuzz_target_path = os .path .join (result .work_dirs .fuzz_targets ,
48
51
f'{ result .trial :02d} .fuzz_target' )
49
- self .write_to_file (fuzz_target_path , result .fuzz_target_source )
52
+ self .write_to_file (fuzz_target_path , result .fuzz_target_source , 'w' )
50
53
51
54
def write_build_script (self , result : Result ) -> None :
52
55
"""Writes build script."""
53
56
build_script_path = os .path .join (result .work_dirs .fuzz_targets ,
54
57
f'{ result .trial :02d} .build_script' )
55
- self .write_to_file (build_script_path , result .build_script_source )
58
+ self .write_to_file (build_script_path , result .build_script_source , 'w' )
56
59
57
60
def write_result (self , result_status_dir : str , result : TrialResult ) -> None :
58
61
"""Writes the final result into JSON for report generation."""
0 commit comments