Skip to content

Commit

Permalink
More error checking for trace folder (Fix #306) (#307)
Browse files Browse the repository at this point in the history
* More error checking for trace folder

* don't be stupid with the variable...

---------

Co-authored-by: Thomas Applencourt <[email protected]>
  • Loading branch information
TApplencourt and Thomas Applencourt authored Jan 8, 2025
1 parent 09613ea commit d8324e6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion utils/babeltrace_thapi.in
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,13 @@ THAPI_METADATA_FILE = 'thapi_metadata.yaml'

def thapi_metadata(trace)
@thapi_metadata ||= {}
@thapi_metadata[trace] ||= YAML.load_file(File.join(trace, THAPI_METADATA_FILE))
full_path = File.join(trace, THAPI_METADATA_FILE)
unless File.file?(full_path)
STDERR.puts("Error: #{trace} isn't a valid trace (missing #{THAPI_METADATA_FILE})")
exit(1)
end

@thapi_metadata[trace] ||= YAML.load_file(full_path)
end

def modify_metadata(command, trace)
Expand Down

0 comments on commit d8324e6

Please sign in to comment.