Skip to content

Commit cd18345

Browse files
committed
Ensure the file's parent dir always exists before writing to it
1 parent 4eb4f3b commit cd18345

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

experiment/measurer/coverage_utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,8 @@ def generate_json_summary(coverage_binary,
276276

277277
if summary_only:
278278
command.append('-summary-only')
279+
# Ensure the directory exists, creating it if necessary
280+
os.makedirs(os.path.dirname(output_file), exist_ok=True)
279281

280282
with open(output_file, 'w', encoding='utf-8') as dst_file:
281283
result = new_process.execute(command,

0 commit comments

Comments
 (0)